Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading from an open word doc to excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Reading from an open word doc to excel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Word document by using Excel Macro Arvind Mane Excel Discussion (Misc queries) 2 September 26th 08 07:55 AM
Excel Hyperlink doesn't open Word doc the same way as Word does duugg Excel Discussion (Misc queries) 2 October 12th 06 03:14 PM
reading password-protected, open webpage Kevin Excel Programming 7 February 17th 04 09:46 AM
Confirm Open After Download - Reading Registry Tim Childs[_6_] Excel Programming 3 November 30th 03 05:31 PM
Graph Excel Selection, Open Word File, Embed Graph Into Word Steve Excel Programming 0 November 17th 03 05:35 PM


All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"