Link to home
Start Free TrialLog in
Avatar of mlcktmguy
mlcktmguyFlag for United States of America

asked on

Using VBA to update spreadhseet

This is a followup to another question I posted on EE.  I have already given the max points on that one so I am following up with another question.Please see
https://www.experts-exchange.com/questions/25632353/ExportCheckbox-to-Excel-Spreadsheet.html?anchorAnswerId=29786103#a29786103 
to get the background on this one.

I have VBA code that creates a spreadsheet from within MS Access.  I then have code contributed by and EE member to alter some attributes in the spreadsheet.  The make the EE code compile I added a reference to MS Excel 11.0 Object library to the MDB.  

The sequence of events in my code is to

1. Create the spreadsheet with the statement:

DoCmd.OutputTo acOutputQuery, "qryMortgageExportOutput", acFormatXLS, wkFileName, False

2. Using the logic from 'GrahamMandeno' I revise the spreadsheet to have the checkboxes using the statement:

wkReturn = ExcelCreateColumnCheckboxes(wkFileName, "Confirm Payment", 1)

What is occuring in production, that didn't occur in test, is that I am getting the message "xxxxxxx is an MS Excel 5.0/95 Workbook.  Do you want to overwrite it with the latest Excel format? Yes, No, Cancel.

It is easy enough to answer this question but in reality these spreadsheets are going to be created in bunches, so the user will have to answer the question many times.  Is there any way to suppress the message and have the system automatically answer "yes' each time?

Or, is there any way to keep the condition causing the message from occuring?  Why are the spreadsheets being created in Excel 5.0/95 format.  I didn't get the message when I was running the 'checkbox' logic on an existing spreadsheet as opposed ot one that was created in the same code stream.














Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

We'd need to see the ExcelCreateColumnCheckBoxes function in order to help.
Avatar of mlcktmguy

ASKER

Is the link that I posted not working?  The entire code is in the question at the link I posted.
ASKER CERTIFIED SOLUTION
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello again
I posted this as an addendum to your previous question before I noticed that you'd started a new question.  So, just in case you missed it...
I suggest you use TransferSpreadsheet instead of OutputTo.  You get to choose the format of spreadsheet to create - including the version of Excel:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, _
  "qryMortgageExportOutput", wkFileName,True
Note that acSpreadsheetTypeExcel8 signifies the Excel 97-2003 format.
--
Graham