knarlyd@hotmail.com
Registered User.
- Local time
- Today, 10:55
- Joined
- Sep 6, 2013
- Messages
- 43
First off, I'm a complete novice with VBA. I'm using Access 2010.
I have a database that during the import of Excel data, it brings up a dialog box, "Minor loss of Fidelity." I've searched high and low but have found nothing to dismiss that box using VBA. Reg hacks have been tried, disabling that "feature" in Excel 2010 have all failed.
I did however find code referenced in the link below and wonder how/if I can use it to to "watch" for that dialog box during transferimport routine, then maybe use SendKeys to dismiss the box, so the import finishes w/o user intervention. Any code, etc. is of course appreciated!
My import code follows the link.
(rather than repost someone else's code):
http://www.everythingaccess.com/tut...external-application-window-to-the-foreground
I have a database that during the import of Excel data, it brings up a dialog box, "Minor loss of Fidelity." I've searched high and low but have found nothing to dismiss that box using VBA. Reg hacks have been tried, disabling that "feature" in Excel 2010 have all failed.
I did however find code referenced in the link below and wonder how/if I can use it to to "watch" for that dialog box during transferimport routine, then maybe use SendKeys to dismiss the box, so the import finishes w/o user intervention. Any code, etc. is of course appreciated!
My import code follows the link.
(rather than repost someone else's code):
http://www.everythingaccess.com/tut...external-application-window-to-the-foreground
Code:
Private Sub Command0_Click()
On Error GoTo PROC_ERR
Dim strpathtofile As String
Dim strTable As String, strBrowseMsg As String
Dim strFilter As String, strInitialDirectory As String
Dim blnHasFieldNames As Boolean
blnHasFieldNames = True
strBrowseMsg = "Select the EXCEL file:"
strInitialDirectory = ""
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.xls")
strpathtofile = ahtCommonFileOpenSave(InitialDir:=strInitialDirectory, _
Filter:=strFilter, OpenFile:=False, _
DialogTitle:=strBrowseMsg, _
Flags:=ahtOFN_HIDEREADONLY)
If strpathtofile = "" Then
MsgBox "No file was selected.", vbOK, "No Selection"
Exit Sub
Else
If Not fSaveExcelFile(strpathtofile) Then
MsgBox "Unable to save file in correct format", vbOK, "Please check ..."
Exit Sub
End If
End If
strTable = "SM_Import"
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDelTblContent"
DoCmd.SetWarnings True
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTable, strpathtofile, blnHasFieldNames, "A10:Z200"
MsgBox "File Imported!", vbInformation, "Import Success"
DoCmd.OpenReport "rpt_Random_Cases_Generated", acViewPreview
Exit Sub
PROC_ERR:
MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & _
"Description: " & Err.Description
MsgBox "Error! " & vbCrLf & "Excel file structure error." & vbCrLf & "File was NOT imported!", vbExclamation, "IMPORT ERROR"
End Sub