Using Call Shell to open Excel Workbook within Access 2003, SP2 Ve

G

Guest

In a Sub procedure, I am updating a spreadsheet from queries within Access.
Then I use the 'Call Shell' in Access to open the spreadsheet for viewing.
When opening the spreadhseet, I get a warning message "File???.xls is
already open. Reopening will cause any changes you made to be discarded. Do
you want to reopen File???.xls Yes/No." Is there a way to
prevent this message from showing and requiring a response from the user? In
my older version of Access 2003, this warning message is not displayed in my
Sub procedure which is the same code.

This is an example of my code in the procedure:
strExportPath = "H:\RevenueReporting_SP2\"

rsPath.Close

'*** Will update Excel workbook. The workbook
UnbilledKWHCalculation.xls must exist in output path.
'*** The workbook must include specified worksheets and designated
range names that correspond to
'*** the query names being used in the export. ***

DoCmd.TransferSpreadsheet acExport, 8,
"qselTerritorialSupplyInformation", strExportPath &
"UnbilledKWHCalculation.xls", False, ""

DoCmd.TransferSpreadsheet acExport, 8, "qselCycleInformation",
strExportPath & "UnbilledKWHCalculation.xls", False, ""

DoCmd.TransferSpreadsheet acExport, 8, "qselUnbilledInformation",
strExportPath & "UnbilledKWHCalculation.xls", False, ""
DoCmd.Save acDefault

MsgBox "Unbilled Test workbook created. Will now display for your
review."

Call Shell("C:\Program Files\Microsoft Office\Office11\excel.EXE " &
strExportPath & "UnbilledKWHCalculation.xls", 1)

Exit_UnbilledTest:
Exit Sub................................
 
J

John Nurick

Hi Larry,

I guess this could be a timing issue. Try calling
DoEvents
after each DoCmd.TransferSpreadsheet.

On Wed, 23 Aug 2006 14:06:02 -0700, Larry Stoudemire <Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top