View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default File Save Question

The Save method does save to the same folder as the workbook's source folder.
In the Help file it states that the method may change the current path. If
the current path is different than the defualt user path and no other path is
specified, it will use the default user path. That was the basis of my
suggestion to include the file path in the name. Very similar the the old
SaveAs method which is what I am more familiar with.



"Ken Hudson" wrote:

I think I got it figured out.
Using the code I had, the macro wanted to save the output to the folder
listed as the default file location in Tools Options... General.
I changed the code to add a string path variable to the strFileSaveName
variable before the save code executes.

The reason I was confused was because other macros I create import text
files, manipulate the data, and then save the WB's as .xls files. When I use
the same save code for those, the default file save location is the folder
from which the text file was opened.
--
Ken Hudson


"Ken Hudson" wrote:

At the end of a macro I have the following code:

strFileSvaeName = Application.GetSaveAsFilename("Test " & strMnth, _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
If strFileSvaeName = "False" Then
MsgBox "Action canceled."
GoTo End_it
End If
ActiveWorkbook.SaveAs Filename:=strFileSvaeName, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False

The WB that contains the macro also has a hyperlink in one of the cells.
This cell is never referenced in the macro. However, when I run the macro,
the default file save location is the hyperlink folder. I don't want that to
be the default file save location.

Have I explained this well enough for someone to tell me how to prevent it?
--
Ken Hudson