OK I must be dumb!!!

  • Thread starter Thread starter Jason Dawson
  • Start date Start date
J

Jason Dawson

Ok guys... I have tried and tried to get what i believed to be a very simple
thing to happen... but no...

All i am trying to achieve is a little bit of code that would open an
existing Excel spreedsheet file so that i can transfer data to it from my
database

I can
1) open a brand new excel spread sheet
2) transfer the data
3) even modify the format of the spreadsheet

But i can't seem to get it to open the existing file, can any one offer
options?

Thanks

Jason
 
Try this code substituting Path with the full path of your
excel book to open....

Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open Path


Glenn
 
This ought to work for you (it does for me):

Dim appXL As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet

Set appXL = New Excel.Application
Set wkb = appXL.Workbooks.Open("C:\MyFolder\MyExcelWorkbook.xls")
Set wks = wkb.Worksheets(1) ' Open Sheet 1
appXL.Visible = True
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top