Hi,
I have code that imports data from excel, and it works great however the problem is an annoying pop up once the import is done telling the user that the file is available for editing and giving them the option to Read-Write or cancel. How do I get rid of this box when the impport is complete?
I tried displayAlerts and it did not work. Thanks for any help you can provide.
Code:
Dim PathStr As String
Dim sPath As String
Dim sheet As String
Dim vDir As Variant
sPath = Forms!frmAgentImport!txtFile 'sPath must end with a back slash,
sheet = Forms!frmAgentImport!txtSheet
vDir = Dir(sPath & "*.*")
PathStr = Forms!frmAgentImport!txtFile
Set xlWB = xlApp.Workbooks.Open(sPath)
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunSQL ("Delete * from tblPreviousYear")
DoCmd.TransferSpreadsheet acImport, 8, "tblPreviousYear", PathStr _
, True, sheet & "!"
Call ExcelQuit
I have code that imports data from excel, and it works great however the problem is an annoying pop up once the import is done telling the user that the file is available for editing and giving them the option to Read-Write or cancel. How do I get rid of this box when the impport is complete?
I tried displayAlerts and it did not work. Thanks for any help you can provide.
Code:
Dim PathStr As String
Dim sPath As String
Dim sheet As String
Dim vDir As Variant
sPath = Forms!frmAgentImport!txtFile 'sPath must end with a back slash,
sheet = Forms!frmAgentImport!txtSheet
vDir = Dir(sPath & "*.*")
PathStr = Forms!frmAgentImport!txtFile
Set xlWB = xlApp.Workbooks.Open(sPath)
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunSQL ("Delete * from tblPreviousYear")
DoCmd.TransferSpreadsheet acImport, 8, "tblPreviousYear", PathStr _
, True, sheet & "!"
Call ExcelQuit