Macro uses "Save As" to a specific location

G

Guest

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
 
G

Guest

ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename &
".xls"

If I am reading your code accurately, the required ".xls" is missing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top