0

Hi, I have to perform Import from Excel file into Access DB, without duplicates. Only way that this can be done is by creating table where you can Import Excel data, and then append It to destination table by buiilding a Query. Problem is that this Excel file has to be .xls format, none other format is working for me (don't know why). How can I do that from Access - desirable without opening Excel workbook, just change It's extension file name ? This is what I tried (I receive error : " object doesn't support this property or method")

Dim XFile As Excel.Application


Set XFile = CreateObject("Excel.Application")
XFile.Workbooks.Open "C:\Users\Mike\Desktop\Copy.xlsx", True

XcelFile.SaveAs Filename:="C:\Users\Mike\Desktop\Copy.xlsx", FileFormat:=56
XFile.Workbooks.Close

End Sub

As you see, I need to save from .xlsx, It's default format for Excel 2013.

Any help much appreciated !!

Community
  • 1
  • 1
LuckyLuke82
  • 586
  • 1
  • 18
  • 58

1 Answers1

1

Thanks @Porcupine911, that worked, even without opening workbook :)

Dim XcelFile As Excel.Application
Dim wb As Excel.Workbook

Set XcelFile = New Excel.Application

Set wb = XcelFile.Workbooks.Open("Filepath here")

wb.SaveAs Filename:="Filename here, with different destination and desirable extension", FileFormat:=56
wb.Close
Set XcelFile = Nothing

End Sub
LuckyLuke82
  • 586
  • 1
  • 18
  • 58