View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stephanie Stephanie is offline
external usenet poster
 
Posts: 93
Default Macro to "Save As"

Thanks Mike. Between your post and Pete's I took the best of both and got it
to run the way I needed it to. Thank you both so much!

"Mike" wrote:

Stephanie,

Try this

Sub saveit()
response = MsgBox("Do you want to Save this to a new file?" _
, vbYesNo, "Save As")
If response = 6 Then
Name = InputBox("Enter a Filename", "Get Filename")
If Name = "" Then End
ActiveWorkbook.SaveAs Filename:="C:\" & Name & ".xls"
End If
End Sub

"Stephanie" wrote:

Hi. I'm trying to create a macro to save as a new document, but I keep
getting a run-time error message when I run it. What it's supposed to do is
ask the user if they want to save it as a new document, if yes, then it
should go through the normal save as procedure (and I'm trying to point it to
a specific directory), if no, then the spreadsheet will just save. Here's
the code I have written. I'm no expert, I'm really just learning this as I
go, so please be gentle. :) Thanks!

If MsgBox("Do you want to Save this to a new file?" _
, vbYesNo, "Save As") = vbYes Then
ActiveWorkbook.SaveAs Filename:="S:\Sales\.xls"
Else
ActiveWorkbook.Save