Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro uses "Save As" to a specific location
I have a save as part written in my code and I want it to save to a specific
folder (Lab_Inspection_Data in My Documents). However, the way I have it written right now does not work. Could someone show me how to write the code so it saves in the correct folder? Here is my code... sFilename = Format(Worksheets("Checklist").Range("H4").Value & "_" & Worksheets("Checklist").Range("B4").Value, "yyyy-mm-dd") ans = MsgBox("Save file as " & sFilename) If ans = vbOK Then ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename End If Thanks, Kyle |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro uses "Save As" to a specific location
ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename &
".xls" If I am reading your code accurately, the required ".xls" is missing. -- Best wishes, Jim "kyle" wrote: I have a save as part written in my code and I want it to save to a specific folder (Lab_Inspection_Data in My Documents). However, the way I have it written right now does not work. Could someone show me how to write the code so it saves in the correct folder? Here is my code... sFilename = Format(Worksheets("Checklist").Range("H4").Value & "_" & Worksheets("Checklist").Range("B4").Value, "yyyy-mm-dd") ans = MsgBox("Save file as " & sFilename) If ans = vbOK Then ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename End If Thanks, Kyle |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validation ?:Accepting both Numbers AND specific letters("N","n"," | Excel Discussion (Misc queries) | |||
"Save" and "Save As" options greyed out - "Save as Webpage" option | Excel Discussion (Misc queries) | |||
"Force" user to save file with specific name | Excel Programming | |||
how do I create a macro to "Go To" a location specified in a cell? | Excel Programming | |||
within a macro how can I suppress the warning pop "A file named xxxx.xls already exists in this location. Do you want to replace it?" | Excel Programming |