View Full Version : Solved: Omitting Path in ActiveWorkbook.Saveas
If no specific path is designated when using "ActiveWorkbook.Saveas," does Excel default to the current location of the existing file being saved?
lucas
03-18-2010, 12:42 PM
I think it defaults to the excel default file location.
In 2003 it's found at tools-Options.........Pick the General tab and it's the 3rd window from the bottom of the dialgog.
lucas
03-18-2010, 12:56 PM
There are several ways to use savas and thisdocument path:
example:
Sub SaveTopath()
Dim DTAddress As String
DTAddress = ActiveWorkbook.Path & "\"
ActiveWorkbook.SaveAs DTAddress & Sheets("Details").Range("R2")
End Sub
Thanks for the help. I'll give your suggestion a try.
Opv
The suggested code works like a charm. Thanks.
This exercise has resulted in another question. Is there an alternative to "saveas" so that I can effectively save a copy of the original file, close the newly saved file and at the same time keep the original file in the active window?
There are several ways to use savas and thisdocument path:
example:
Sub SaveTopath()
Dim DTAddress As String
DTAddress = ActiveWorkbook.Path & "\"
ActiveWorkbook.SaveAs DTAddress & Sheets("Details").Range("R2")
End Sub
lucas
03-18-2010, 08:36 PM
The suggested code works like a charm. Thanks.
This exercise has resulted in another question. Is there an alternative to "saveas" so that I can effectively save a copy of the original file, close the newly saved file and at the same time keep the original file in the active window?
Use savecopyas
Sub SaveAsExample()
Dim DTAddress As String
DTAddress = ActiveWorkbook.Path & "\"
ActiveWorkbook.SaveCopyAs DTAddress & Sheets("Details").Range("R2") & ".xls"
End Sub
Very cool. I wish I had realized the power of VBA years ago. I appreciate the help.
Opv
Use savecopyas
Sub SaveAsExample()
Dim DTAddress As String
DTAddress = ActiveWorkbook.Path & "\"
ActiveWorkbook.SaveCopyAs DTAddress & Sheets("Details").Range("R2") & ".xls"
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.