Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use VBA to collect information from Excel cells to av word documen
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("Sh eetName").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("SheetNam e").Cells(1,1)) This gives med tha same as Text =cstr(Exel.Workbooks("BookName.xls").Worksheets("S heetName").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 -- Øyvind |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use VBA to collect information from Excel cells to av word documen
GetObject and CreateObject are the ways to go.
IF it works in VB6, it should work in VBA I assume you have opened BookName.xls and it has a sheet named SheetName You may want to look at the Automation Help file http://support.microsoft.com/default...b;en-us;260410 Microsoft Office 2000 automation Help file is available in the Download Center -- Regards, Tom Ogilvy "Øyvind" wrote in message ... 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("Sh eetName").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("SheetNam e").Cells(1,1)) This gives med tha same as Text =cstr(Exel.Workbooks("BookName.xls").Worksheets("S heetName").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 -- Øyvind |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use VBA to collect information from Excel cells to av word doc
I had activated the workbook with current sheet. I read the automation help
file. Thank you Tom. -- Øyvind "Tom Ogilvy" wrote: GetObject and CreateObject are the ways to go. IF it works in VB6, it should work in VBA I assume you have opened BookName.xls and it has a sheet named SheetName You may want to look at the Automation Help file http://support.microsoft.com/default...b;en-us;260410 Microsoft Office 2000 automation Help file is available in the Download Center -- Regards, Tom Ogilvy "Øyvind" wrote in message ... 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("Sh eetName").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("SheetNam e").Cells(1,1)) This gives med tha same as Text =cstr(Exel.Workbooks("BookName.xls").Worksheets("S heetName").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 -- Øyvind |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to setup formula to collect ongoing information | New Users to Excel | |||
How can I collect specific data from cells in a fill-in form? | Excel Discussion (Misc queries) | |||
Is it possible to do spellcheck in partially-locked excel documen. | Excel Discussion (Misc queries) | |||
VBA Problem - How to collect and display text information from applicable cells. | Excel Programming | |||
how to read multiple workbooks, collect a few cells from each? | Excel Programming |