G
Guest
I need to have control over file naming in a worksheet would like to be able
to do this by assiging a macro to a button.
to do this by assiging a macro to a button.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Tom Ogilvy said:where cell B9 contains the string
C:\Temp\MyFile.xls
Tom Ogilvy said:sPath = "C:\Temp\"
ActiveWorkbook.SaveAs sPath & Activesheet.Range("B9").Value
where cell B9 contains the name you want.
------------------
if you want the path in B8 and the name in B9
sPath = Range("B8").Value
if Right(spath,1) <> "\" then sPath = sPath & "\"
ActiveWorkbook.SaveAs sPath & Activesheet.Range("B9").Value
------------------
If you want to save in the same location as the activeworkbook currently is
located
sPath = ActiveWorkbook.Path
if Right(spath,1) <> "\" then sPath = sPath & "\"
ActiveWorkbook.SaveAs sPath & Activesheet.Range("B9").Value
There was not anything in the b9 cell. I am new to the use of macros and need
a step by setp layout of what I need to do. I am tring to set up a templet
that I will have control over the file name by entering data into a cell. So
if I ener a name in cell b9 I when I click my command button I would like to
have the file saved as the name in cell b9.
Dave Peterson said:I meant what was in B9 when the code failed?
msgbox "***" & activesheet.range("b9").value & "***"
would show you the value surrounded by asterisks.
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.