Save As

  • Thread starter Thread starter HH
  • Start date Start date
H

HH

I use the Save As feature to save a copy of my workbook to a network laptop.
My intent is to have a back up copy on the laptop.

When I try to use the custom toolbar on the original file the command
buttons direct me to the Save As file on the network laptop. The only way I
have found to stop this is to us the Save As feature again to save it back
to the desktop. The same file name is used on the desktop and laptop. If
I forget the second "save as" I have to reset the proper macro to the proper
button on the custom toolbar.

Is there as better way?

Hank
 
G'day Hank

Don't use the Menu/Ribbon Save button, place this code behind a MacroButton
on the WB itself.

Sub Save_Me()

Dim MyFileExtStr As String
Dim MyWB As Workbook
Dim MyFileDate As String

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set MyWB = ActiveWorkbook

With MyWB
If Val(Application.Version) < 12 Then
MyFileExtStr = ".xls": MyFileFormatNum = -4143
Else
If .HasVBProject Then
MyFileExtStr = ".xlsm": MyFileFormatNum = 52
Else
MyFileExtStr = ".xlsx": MyFileFormatNum = 51
End If
End If
End With

MyFileDate = Format(Now, "mmm-yyyy")

With MyWB
ChDir "E:\Work_Stuff\" ' REPLACE WITH YOUR PRIMARY SAVE LOCATION
.SaveAs Filename:="E:\Work_Stuff\SalesFigures" & " For " &
MyFileDate & MyFileExtStr, FileFormat:=MyFileFormatNum
On Error Resume Next

ChDir "E:\Work_Stuff\" ' REPLACE WITH YOUR LAPTOP LOCATION
.SaveAs Filename:="E:\Work_Stuff\SalesFigures" & " For " &
MyFileDate & MyFileExtStr, FileFormat:=MyFileFormatNum
On Error Resume Next

End With

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

HTH
Mark.
 
Thanks Mark,
The code was just what I needed. I made a couple of change. See if I did
anything that I should not have done.
1. Turns out the laptop is a Vista and a user name and password are
required. So I am saving to a thumb drive to transfer later.
2. I could not get the code to work with the .....& " For " &
MyFileDate & MyFileExtStr, FileFormat:=MyFileFormatNum ...
So I added the .xls file extension and deleted that part. Could this be a
problem?
3. I reversed the save order so that I was saving the PRIMARY location last.
Before I did that I still had the same problem with my custom button/macros.

As far as I see now everything works great ... Thanks again

Hank
 
Your welcome Hank

Glad I could help

Appreciate the feedback.

Regards
Mark.
 

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

Back
Top