View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default HOw do you save a file using a macro?

two possibilities...

1)

Sub SaveFileAs()
Dim sFileName As String
sFileName = Application.GetSaveAsFilename
If sFileName = "False" Then Exit Sub
ActiveWorkbook.SaveAs sFileName
End Sub

2)

Sub SaveFileAs()
Dim sFileName As String
sFileName = InputBox("Enter Name to be saved as...")
If sFileName = "" Then Exit Sub
ActiveWorkbook.SaveAs sFileName
End Sub


just a couple of ideas
you could also add
ActiveWorkbook.Close False
before the End Dub to close the file after saving it.

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I'm trying to save a file with a macro. I have 90

different files that
I'm running the same macro on. When it's done I want

the macro to save
it but with a different name.

Right now the code is setting the name of the file to

the first name I
put in (e.g. CMAC301). I want the next file to be named

CMAC302. How
do I do that?

When I had Office 97, I was able to somehow pause the

macro, input data
as I needed and then resume. Is this still available?

HELP!!!!!!!!!!!!!!!!!!!!!!



------------------------------------------------
Message posted from the Excel Tip Forum at

http://www.ExcelTip.com/forum/

-- View and post usenet messages directly from

http://www.ExcelTip.com
-- Hundreds of free MS Excel tips, tricks and solutions
------------------------------------------------
.