Save As

K

katmando

Hi
I have a macro that performs a load of formatting to a workbook. At the
end of it i would like to save a copy of it (i.e save as) in a
particular folder. The path will always be the same, but i would like
the user to enter the actual name that the file will be called.

Can someone point me in the right direction for the syntex

Thanks
 
N

Norman Jones

Hi Katmando,

Try:

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim sPath As String
Dim sFilename As String

Set WB = ActiveWorkbook '<===== CHANGE

sPath = "C\MyFolder\" '<===== CHANGE

If Right(sPath, 1) <> "\" Then sPath = sPath & "\"

sFilename = InputBox("Please type the new file name")

WB.SaveAs FileName:=sPath & sFilename & ".xls", _
FileFormat:=xlWorkbookNormal
End Sub
'<<=============
 

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