SaveCopyAs

  • Thread starter Thread starter Greg Hadrych
  • Start date Start date
G

Greg Hadrych

I am working with the code "SaveCopyAs" and have run in to
a wall. What I want is when I click on a button in my
document; I want excel to ask if the user wants to save
the document and if so, save it as a user defined name and
location. I know I could set the original as read-only
but I do not want to do that.

Private Sub Save_As_Click()

Workbooks("Master Template v2.1.XLS").SaveCopyAs

End Sub

This is the code I have so far but do not know what to
place after "SaveCopyAs"
 
Greg,

You have to include the full save-as file name after SaveCopyAs.
E.g,

Workbooks("Master Template v2.1.XLS").SaveCopyAs _
"C:\Temp\MasterBackup.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thanks for the help ... seeing as how i know very little
about coding, where would i but that string of code?
Right afer what i have or somewhere else?
-----Original Message-----
str_Destination_FileName = Application.getSaveAsFileName
(fileFilter:="Excel Files (*.xls), *.xls")
 
Here's one example:

Sub SaveCopyAsToSameDirectory()
Dim lStr_TargetFile As String

With ThisWorkbook
.SaveCopyAs ThisWorkbook.Path & "\" & _
Left(ThisWorkbook.Name, InStr(1, LCase(ThisWorkbook.Name), ".xls") -
1) & _
" - " & Format(Now, "yyyymmdd hhmmss") & ".xls"
.Save
End With

End Sub

There are more at: http://www.bygsoftware.com/Excel/VBA/saving.htm

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
Back
Top