I am still trying to copy an Excel file from a parent folder to a sub-folder, that this code creates, and name the copied file with the name used to name the sub-folder, using the name entered in a control field (named 'TheDirName) of an Access 2007 form. Here is my VBA, which names the copied file "TheDirName.xlsx.:
Private Sub MakeDir_Click()
Dim appExcel As Excel.Application
Dim lngLastDataRow As Long
Dim Folder_Path As String
'Create path for customer folder & files
strFolder_Path = "C:\R11Bidder13\" & (Me.TheDirName)
If Dir(Me.TheDirName, vbDirectory) = "" Then
If MsgBox("OK to create folder!", vbOKCancel) = vbOK Then
MkDir strFolder_Path
'The name entered into the 'TheDirName' window of the "Customers"_ form.
Else
MsgBox "Create folder cancelled. Folder not created."
Exit Sub
End If
Else
MsgBox "The folder already exists..." & Chr(10) & "Please check the_ directories using Windows Explorer.", vbOKOnly
Exit Sub
End If
Response = MsgBox(TheDirName, vbOKOnly)
'Copy the file 'Bidder.xls' to the newly created folder.
FileCopy "C:\R11Bidder13\Bidder.xlsx", strFolder_Path &- "\TheDirName.xlsx"
End Sub
Private Sub MakeDir_Click()
Dim appExcel As Excel.Application
Dim lngLastDataRow As Long
Dim Folder_Path As String
'Create path for customer folder & files
strFolder_Path = "C:\R11Bidder13\" & (Me.TheDirName)
If Dir(Me.TheDirName, vbDirectory) = "" Then
If MsgBox("OK to create folder!", vbOKCancel) = vbOK Then
MkDir strFolder_Path
'The name entered into the 'TheDirName' window of the "Customers"_ form.
Else
MsgBox "Create folder cancelled. Folder not created."
Exit Sub
End If
Else
MsgBox "The folder already exists..." & Chr(10) & "Please check the_ directories using Windows Explorer.", vbOKOnly
Exit Sub
End If
Response = MsgBox(TheDirName, vbOKOnly)
'Copy the file 'Bidder.xls' to the newly created folder.
FileCopy "C:\R11Bidder13\Bidder.xlsx", strFolder_Path &- "\TheDirName.xlsx"
End Sub