Full Version: Macro + VBA
UtterAccess Discussion Forums > Microsoft® Office > Microsoft Excel
rj_hunter
Hi there,

This is what I have so far in my Marco and it seems to work fine:




Private Sub Workbook_SaveAs()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub




What I would like to do next to specify a file path save e.g. “c:\temp” and not sure how to add it into the VBA code above.

Also I would also like to run the above code every time the file is opened up. Note sure how one would do this with VBA code.

Any help would be gladly appreciated.

Thank you,

Robert
fkegley
ThisFile = "c:\temp" & Range("A1").Value

Tools--->Macro--->VBA Editor.

If Project Explorer is not visible on the left, usually, View--->Project Explorer

Under the name of the workbook tree, click This Workbook. In the Dropdown on the left select Workbook. In the dropdown on the right select Open.

Type in the name of your macro.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.