SaveCopyAs

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"
 
C

Chip Pearson

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
 
G

Greg Hadrych

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")
 
A

Andy Wiggins

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"
 

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