Save html to Excel within Access 2003

C

Crossh

Is there a way to save an .html file as an excel file within a module in
Access? I need to import the data into Access, but when I import the .html,
the fields get all mixed up. If I open it manually in excel, save it as an
excel file, then import it into Access using DoCmd.TransferSpreadsheet, it
imports correctly. I just would rather not rely on the users to do this
manually. Thanks in advance for your help :)
 
R

Ralph

sub convertHtml
Const xlExcel7 = 39
Dim xl As Object
Dim xlWb As Object
Set xl = CreateObject("Excel.Application")
Set xlWb = xl.Workbooks.Open(Filename:=CurrentProject.Path & "\emp.html")
xlWb.SaveAs Filename:=CurrentProject.Path & "\emp.xls",FileFormat:=xlExcel7
xlWb.Close
xl.Quit
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top