Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to read data from an open word document into an excel spread
sheet. I think the way to access the document is to use the getobject method. I don't want users to have to enter the path name I just want to have the word document open and read from there. According to the help files for GetObject([pathname] [, class]) If the pathname argument is omitted, GetObject returns a currently active object of the specified type. The class has the format appname.objecttype I have tried set myobject = getobject(,"word.documents") but get an 429 error message "Activex component can't create object". Can some one help me here do I have the right syntax? do I have the correct class syntax( I have tried other guesses without success). Thanks in advance Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim oWd Set oWd = GetObject(, "word.application") If Not oWd Is Nothing Then MsgBox oWd.activedocument Else MsgBox "Word is not running" End If End Sub notes: 1. if there is 1 instance of word runnnig then there is no guarantee on which instance will be returned by getobject, nor is there any way to control this 2. need to add some code to check if there is an activedocument 3. If you know the path to the word file you might be better off using that as the first parameter otherwise (1) may trip you up... Tim -- Tim Williams Palo Alto, CA "sparkle_guy" wrote in message ... I would like to read data from an open word document into an excel spread sheet. I think the way to access the document is to use the getobject method. I don't want users to have to enter the path name I just want to have the word document open and read from there. According to the help files for GetObject([pathname] [, class]) If the pathname argument is omitted, GetObject returns a currently active object of the specified type. The class has the format appname.objecttype I have tried set myobject = getobject(,"word.documents") but get an 429 error message "Activex component can't create object". Can some one help me here do I have the right syntax? do I have the correct class syntax( I have tried other guesses without success). Thanks in advance Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Reading Word document by using Excel Macro | Excel Discussion (Misc queries) | |||
Excel Hyperlink doesn't open Word doc the same way as Word does | Excel Discussion (Misc queries) | |||
reading password-protected, open webpage | Excel Programming | |||
Confirm Open After Download - Reading Registry | Excel Programming | |||
Graph Excel Selection, Open Word File, Embed Graph Into Word | Excel Programming |