General Ledger
Active Member
- Joined
- Dec 31, 2007
- Messages
- 460
Dear All,
I am trying to create code that will take the name of the active file (csv, txt, xls, xlsx), concatenate the current date and time, and open Save As dialog box with a default folder.
The below code does all that except finding the name of the active file. How can I pull just the name of the file from the active file?
Thank you,
GL
I am trying to create code that will take the name of the active file (csv, txt, xls, xlsx), concatenate the current date and time, and open Save As dialog box with a default folder.
The below code does all that except finding the name of the active file. How can I pull just the name of the file from the active file?
Code:
Sub SaveAsDialog()
Dim strFolder As String
FileName = "Accounts Payable " & Format(Now, "yyyy-mm-dd hh mm") & ".xlsx"
With Application.FileDialog(msoFileDialogSaveAs)
.AllowMultiSelect = False
.InitialFileName = "P:\Audit 2011\" & FileName
.InitialView = msoFileDialogViewDetails
If .Show = -1 Then strFolder = .SelectedItems(1) Else Exit Sub
.Execute
End With
End Sub
Thank you,
GL