Use VBA to collect information from Excel cells to av word documen

G

Guest

I have reference Office 11.0 Object lib. as a default. To get all the Excel
objects i activate the Microsoft Excel 11.0 Object library.

Then i can brows it all, by then i create a VBA code then VBA can't use the
Excel Objects as :
Dim Text as string
Text=cstr(Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

I have tried a line i use in VB6

Dim XLS
Dim Text as string
set XLS = GetObject(, "Excel.Application")

XLS.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

This gives med tha same as
Text =cstr(Exel.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

I can brows the object model, but i can't use it.

Is there an other code that enebles the Excel object model in WORD.

Best regards
 
G

Guest

I had activated the workbook with current sheet. I read the automation help
file.
Thank you Tom.
 

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