[AccessD] Preventing user prompts from Excel

Brett Barabash BBarabash at TappeConstruction.com
Tue Jul 13 15:02:44 CDT 2004


Hi John,
Try xlApp.DisplayAlerts = False
(it's the equivalent of DoCmd.SetWarnings False) 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John
Sent: Tuesday, July 13, 2004 2:45 PM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] Preventing user prompts from Excel

--------------Please open with care!------------ This message has
bypassed some of our spam filtering rules.
This message was scanned for viruses and executable code has been
stripped.
---------------------------------------------------------------

I am doing imports from data sent to us in Excel spreadsheets which I
Link to the db then build queries on the resulting "table".  In order to
make sure that the spreadsheet is named something consistent (so that
the link functions correctly), I am using the following function to
rename a spreadsheet in Excel.

Function XLRenameSpreadsheet(strFileName As String, strTblName As
String) On Error GoTo Err_XLRenameSpreadsheet
    Dim xlApp As Object
    Dim xlWs As Object
    Set xlApp = CreateObject("Excel.application")
    
    xlApp.Workbooks.Open strFileName
    Set xlWs = xlApp.Workbooks(1).Worksheets(1)
    xlWs.Name = strTblName
    
Exit_XLRenameSpreadsheet:
On Error Resume Next
    xlApp.Workbooks(1).Close True
    Set xlWs = Nothing
    If Not (xlApp Is Nothing) Then xlApp.Close: Set xlApp = Nothing Exit
Function
Err_XLRenameSpreadsheet:
        MsgBox Err.Description, , "Error in Function
basUtils.XLRenameSpreadsheet"
        Resume Exit_XLRenameSpreadsheet
    Resume 0    '.FOR TROUBLESHOOTING
End Function

Unfortunately I get a message:

	 "XXX.XLS is a Microsoft Excel 5.0/95 workbook.  Do you want to
overwrite it with the latest Excel format" 

when I try and do the save

    xlApp.Workbooks(1).Close True

Since this is an automated process there is no one around to answer yes
(Excel can be so stupid sometimes).

Is there any way to force a yes (or no, I don't really much care what
the format is!)

JWC
--

--------------------------------------------------------------------------------------------------------------------
The information in this email may contain confidential information that 
is legally privileged. The information is only for the use of the intended 
recipient(s) named above. If you are not the intended recipient(s), you 
are hereby notified that any disclosure, copying, distribution, or the taking 
of any action in regard to the content of this email is strictly prohibited.  If 
transmission is incorrect, unclear, or incomplete, please notify the sender 
immediately. The authorized recipient(s) of this information is/are prohibited 
from disclosing this information to any other party and is/are required to 
destroy the information after its stated need has been fulfilled.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Tappe Construction Co.

This footer also confirms that this email message has been scanned
for the presence of computer viruses.Scanning of this message and
addition of this footer is performed by SurfControl E-mail Filter software
in conjunction with virus detection software.




More information about the AccessD mailing list