GetObject

L

Let2Editor

I am advised that I can 'open' a document invisibly in order to retrieve a
certain bookmarks content by assigning the document to an object.

Dim odoc As Object
Set oDoc = GetObject("filename")
(text)= odoc.Bookmarks("bkname").Range

It all works, but for some reason it routinely takes about 15 to 20
(interminable) seconds for the odoc object to be created. Am I doing something
wrong?

Ed
 
H

Helmut Weber

Hi,

if you are talking about Word-VBA,
this is the way you would do it:

Dim dTmp As Document
Set dTmp = Documents.Open("c:\test\test-002.doc", Visible:=False)
MsgBox dTmp.Bookmarks("Mark1").Range.Text
dTmp.Close
Set dTmp = Nothing

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
Top