Hi friends,


High chance this is unsolvable because what i'll show you makes absolutely 0 sense...


The code below is using the Excel Object lib within MS Access. Purpose is create a query, export that query to Excel using built-in Access "DoCMD.TransferSpreadsheet" then edit some of the content of that spreadsheet.


....

If IsQuery("Temp_Export2Excel") Then DoCmd.DeleteObject acQuery, "Temp_Export2Excel"
        Set qdf = CurrentDb.CreateQueryDef("Temp_Export2Excel", Source)
    
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, qdf.Name, PathandFilename, True
    MsgBox PathandFilename
    
    Set wBook = appExcel.Workbooks.Open(PathandFilename)

....

The pathandfilename var is a string that is retrieved from msofiledialogfilepicker. It works fine. The interesting thing is that when I REPLACE an existing file, all is well. However, when I am CREATING a new file, the Workbook.Open event can't find the file. Which again, makes no theoretical sense because..

The docmd does in fact create the spreadsheet in the exact location. I can put a codebreak right after and it does exactly what it intended. Running msgbox on the filepath (above) returns the correct filepath.

So.. something else is up.

Ideas?

Thanks