vba to save xlsm as xlsx and prompt for part of file name

hinesgg

New Member
Joined
Jul 11, 2012
Messages
30
I have code that saves my file as xlsx properly, but I need to modify the file name with user input each time.

Code:
' Save workbook as XLSX file and append date</SPAN></SPAN>
ActiveWorkbook.SaveAs Filename:="C:\Users\aurgaiha\Documents\Playground\Amanda\Daily VMI Report" & Format(Now, " mm-dd-yyyy"), FileFormat:=51</SPAN>
but I need to have the user modify the file name each time to include the time of the last database update.

The code above results in the filename Daily VMI Report 12-18-2013.xlsx but I need for the name to read Daily VMI Report 12-18-2013 as of 9am (or 12pm, or 2pm, or 4pm, etc.)

Can I include an Input Box to modify the file name before the file is saved?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
OK, try:

Code:
    Dim Answer As String
    Answer = InputBox("What time?")
'   Save workbook as XLSX file and append date
    ActiveWorkbook.SaveAs FileName:="C:\Users\aurgaiha\Documents\Playground\Amanda\Daily VMI Report" & Format(Now, " mm-dd-yyyy") & " " & Answer & ".xlsx", FileFormat:=51
 
Upvote 0
If you have a question, this site requires that you post it as a new question and not add it to this thread. I found that out the hard way :-)
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top