#1
|
|||
|
|||
Saving file with variable in file name
I am attempting to create a bunch files from a pivot table using VBA. I'm running into a problem wherein the variable is not working when saving the file.
To obtain the variable, at the start of the macro, I am using a input box. That code sits at the top of the macro, in the same module as the remaining sub's. That code: Dim vReport_Date As String vReport_Date = Application.InputBox("Enter Date", "Enter Report Date", "") Then in each sub macro I am attempting to use that variable in the file name with the following code: ActiveWorkbook.SaveAs Filename:="{Path listed here}\{set part of file name here} " & vReport_Date, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False The file is saving; however, the variable does not appear. Rather it saves as just the set part of the file name Any suggestions would be greatly appreciated. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
saving a file | Beebop | Word | 1 | 08-30-2017 09:20 PM |
Split file using variable delimiter | kramer74 | Word VBA | 7 | 09-01-2014 12:12 AM |
Word does not ask do i want to overwrite a file on saving a file | sam2149 | Word | 2 | 03-24-2014 04:18 AM |
Saving mpp file as XML | OTPM | Project | 7 | 02-26-2014 07:22 AM |
switching windows for variable file name | jillapass | Word VBA | 1 | 04-21-2012 02:59 AM |