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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,216,167
Messages
6,129,263
Members
449,497
Latest member
The Wamp

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