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
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_25632353.html#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.














LVL 1
mlcktmguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
We'd need to see the ExcelCreateColumnCheckBoxes function in order to help.
0
mlcktmguyAuthor Commented:
Is the link that I posted not working?  The entire code is in the question at the link I posted.
0
Ken ButtersCommented:
try using docmd.transferSpreadsheet instead of docmd.OutputTo

Syntax

docmd.TransferSpreadsheet(TransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOA)

SpreadsheetType is used to specify the  version of excel being used.
see: http://msdn.microsoft.com/en-us/library/bb214134.aspx

acSpreadsheetTypeExcel3 0 Microsoft Excel 3.0 format
acSpreadsheetTypeExcel4 6 Microsoft Excel 4.0 format
acSpreadsheetTypeExcel5 5 Microsoft Excel 5.0 format
acSpreadsheetTypeExcel7 5 Microsoft Excel 95 format
acSpreadsheetTypeExcel8 8 Microsoft Excel 97 format
acSpreadsheetTypeExcel9 8 Microsoft Excel 2000 format
acSpreadsheetTypeLotusWJ2 4 Japanese version only
acSpreadsheetTypeLotusWK1 2 Lotus 1-2-3 WK1 format
acSpreadsheetTypeLotusWK3 3 Lotus 1-2-3 WK3 format
acSpreadsheetTypeLotusWK4 7 Lotus 1-2-3 WK4 format
acSpreadsheetTypeExcel12 => Value: 9; Format: xls
acSpreadsheetTypeExcel12Xml => Value: 10; Format: .xlsx



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrahamMandenoCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.