I have a database that I am trying to import an excel file into. The excel file is coming from a Third Party software and is not importing. I get errors that it is not in a recognizable format, although the file HAS AN .xls extensnion. I open the file in Excel and then go to “Save As” and the Format is “Web Page (*.htm, *.html)”….
If I change the format to .xls and save Access Accepts the File no problem.
Yes I can make my users do this step but I am looking to automate this. They already have to create the xls file in a 3rd party software. I want to eliminate the Excel save and handle it from Access.
I can use the code below to open Excel and save the file but it saves as the same format. After I run the code open it again with Excel and do a Save As and again it shows the format of “Web Page (*.htm, *.html)”
I have seen examples like this: although it does not like the FileFormat:=xlNormal
Code:wbk.SaveAs "F:\NEW_DATA_AFTER_SAVE_OFF\ENGINEERING_MAILING_LAB ELS\Mailing_Labels2.xls", FileFormat:=xlNormal
Does anyone out there know how I can specify the format to save as an xls file and not a web page
Thanks
Code:
Code:Dim xl As Object Set xl = CreateObject("Excel.Application") Dim wbk As Object Set wbk = xl.Workbooks.Open("F:\NEW_DATA_AFTER_SAVE_OFF\ENGINEERING_MAILING_LAB ELS\Mailing_Labels.xls") Dim wsht As Object Set wsht = wbk.worksheets("Mailing_Labels") Dim strFileName As String Dim lastRow As Integer With xl .Visible = True .UserControl = True xl.DisplayAlerts = False wbk.SaveAs "F:\NEW_DATA_AFTER_SAVE_OFF\ENGINEERING_MAILING_LAB ELS\Mailing_Labels2.xls" wbk.Close End With Set xl = Nothing