T
Tom Jones
Dear all,
I have a problem with a vba script on just one PC. I am using the
following code to import the contents of another Word document into our
Letterhead templates when a new document is created:
'** Code begins
Sub Update_Partners()
Dim I, newfooter, footerBmark, update_loc
Set I = ActiveDocument
Dim oWordDoc As Word.Document
update_loc = "\\server1\data\footer.Doc"
'Open the document with GetObject (so it's invisible)
Set oWordDoc = GetObject(update_loc)
newfooter = oWordDoc.Bookmarks("steeles_footer").Range.Text
Set footerBmark = i.Bookmarks("steeles_partners").Range
footerBmark.Text = newfooter
footerBmark.Font.Bold = False
i.Bookmarks.Add Name:="steeles_partners", Range:=footerBmark
'Close the document
oWordDoc.Close
Set oWordDoc = Nothing
End Sub
'** Code ends
This works fine on all our PCs (over 150) - except for one, which hangs
for about 30 seconds on the GetObject statement. I have tried setting
the class (I think to "Word.Document" but that made no difference at
all.
Has anyone got any ideas what the problem could be (no luck on Google),
or if there is an alternative way of achieving the import of the file.
Thanks for any help you can provide,
Tom.
I have a problem with a vba script on just one PC. I am using the
following code to import the contents of another Word document into our
Letterhead templates when a new document is created:
'** Code begins
Sub Update_Partners()
Dim I, newfooter, footerBmark, update_loc
Set I = ActiveDocument
Dim oWordDoc As Word.Document
update_loc = "\\server1\data\footer.Doc"
'Open the document with GetObject (so it's invisible)
Set oWordDoc = GetObject(update_loc)
newfooter = oWordDoc.Bookmarks("steeles_footer").Range.Text
Set footerBmark = i.Bookmarks("steeles_partners").Range
footerBmark.Text = newfooter
footerBmark.Font.Bold = False
i.Bookmarks.Add Name:="steeles_partners", Range:=footerBmark
'Close the document
oWordDoc.Close
Set oWordDoc = Nothing
End Sub
'** Code ends
This works fine on all our PCs (over 150) - except for one, which hangs
for about 30 seconds on the GetObject statement. I have tried setting
the class (I think to "Word.Document" but that made no difference at
all.
Has anyone got any ideas what the problem could be (no luck on Google),
or if there is an alternative way of achieving the import of the file.
Thanks for any help you can provide,
Tom.