I am using access to create an excel file and perform a save as. The only part that doesn't seem to be working is defining the starting directory. It does put in the file name correctly. I have reviewed some of the threads and tried the suggestions such as below and they didn't seem to alter the starting directory. The starting directory continues to show as whatever the last one I pointed to via the mouse was. Is it because I'm trying to save it from Access rather than within Excel or because I'm trying to save to a network drive instead of hard disk, or do I need to use UNC instead of drive letter? Note: drive letter is defined by IT for all users so there is no issue of people having a different drive letter assignment.
I tried defining the default name as follows:
[tt]stDefaultName = "F:\Project Reports\Output\Upload1_" & Format(Forms!frmmain.txtEndDate, "yyyymmdd") & ".xlsx" [/tt]
The directory does not display as "F", stays at "C"
I also tried:
When I step through code and do a dir statement to the immediate window, it shows the directory has been changed, but maybe that is only changing the directory for Access and has no impact on Excel?
Code:
FName = wb.Application.GetSaveAsFilename(InitialFileName:=stDefaultName, FileFilter:= _
" Excel Macro Free Workbook (*.xlsx), *.xlsx", _
FilterIndex:=2, Title:="Save to a new workbook")
[tt]stDefaultName = "F:\Project Reports\Output\Upload1_" & Format(Forms!frmmain.txtEndDate, "yyyymmdd") & ".xlsx" [/tt]
The directory does not display as "F", stays at "C"
I also tried:
Code:
ChDrive Forms!frmmain.txtLocation & " Reports\Output\"
ChDir Forms!frmmain.txtLocation & " Reports\Output\"