If Excel_Default_Path
is set to C:\ProjectOutput the following code works perfectly. But if Excel_Default_Path
is set to C:\Users\Me\ProjectOutput it fails with a 1004 error. Also, the appExcel
object has no problem at all reading from that same directory in either case.
The DefaultOutputFilename
is set to AA1FS-7_VE8GUS_ED.xls and fmt
is getting the correct type. Just putting it into the User directory is a problem though.
A little more info. If I quit out of the VB app and select the open Excel app. I can directly save the modified workbook to C:\Users\Me\ProjectOutput
with no problem at all.
Also, this error occurs on my machine, as well as another machine. The other machine Excel_Default_Path
is set to C:\Users\JSS\ProjectOutput
Dim fmt As Excel.XlFileFormat = GetExcelFileFormatForExtension(fi)
appExcel.ActiveWorkbook.SaveAs(CStr(Excel_Default_Path & "\" & DefaultOutputFileName), fmt)