rjbinney
Active Member
- Joined
- Dec 20, 2010
- Messages
- 292
- Office Version
- 365
- Platform
- Windows
I have a file with some macros that do a "Save As".
(One is to save a backup to an external drive, another strips all of the formulas to save on my phone... Yes, maybe I'm a little anal about this file! It's a database I've been building since my days of 1-2-3 on the computer lab in grad school...)
Anyways, when I click the Macro, it always lets me know the Save As is writing over an existing document. Is there a way to force the Macro to go ahead and save without the confirmation?
Also, it wants to confirm that my macros will be dumped when I save it in a Macro-Free format (for my phone). Can I also suppress THAT confirmation?
Thanks
(One is to save a backup to an external drive, another strips all of the formulas to save on my phone... Yes, maybe I'm a little anal about this file! It's a database I've been building since my days of 1-2-3 on the computer lab in grad school...)
Anyways, when I click the Macro, it always lets me know the Save As is writing over an existing document. Is there a way to force the Macro to go ahead and save without the confirmation?
Also, it wants to confirm that my macros will be dumped when I save it in a Macro-Free format (for my phone). Can I also suppress THAT confirmation?
Thanks
Code:
Sub SaveForDevicesFixed()
'Save Current
ActiveWorkbook.Save
'Save Local Backup
ChDir "C:\Users\RJB\Documents"
ActiveWorkbook.SaveAs Filename:="Inventory Backup.xlsm", FileFormat:=52
'Strip Formulas
Sheets.Select
Sheets("Inventory").Activate
Cells.Select
Range("b1").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Strip Button
ActiveSheet.Buttons.Delete
'Save to X
If XExists("X:\Device Documents\Music") Then
ChDir "X:Device Documents\Music"
ActiveWorkbook.SaveAs Filename:="Inventory for DG.xlsx", FileFormat:=51
End If
'Save to DTG
ChDir "C:\Users\RJB\Docs to Go\Music"
ActiveWorkbook.SaveAs Filename:="Inventory for DTG.xlsx", FileFormat:=51
End Sub
'Check if External Drive is Connected
Private Function XExists(ByVal Path As String) As Boolean
On Error Resume Next
XExists = Dir(Path, vbDirectory) <> ""
End Function
Last edited: