Hi keith74,
I am not very sure what your code is, but I think you can try this-
Create an instance of Document object. (Dim myDoc as Document)
Instantiate this with your document
Now, you don't need to use activedocument, you can refer to your document by
this object variable.
also look at the range start, end values.
Regards,
Pranav Vaidya
> Hi All
>
[quoted text clipped - 13 lines]
>
> keith
Keith74 - 05 Jul 2007 11:26 GMT
Hi there
This is an example of something that doesn't work
If IsNull(ADORecordset!Line1) = True Or Len(Trim(ADORecordset!
Line1)) < 1 Then
objWordDoc.Bookmarks("Line1").Select
objWordDoc.Bookmarks("Line1").Delete
objWordDoc.Selection.MoveDown Unit:=5, Count:=1, Extend:=1
objWordDoc.Selection.Delete Unit:=1, Count:=1
Else
objWordDoc.Bookmarks!Line1.Range.Text = Trim(ADORecordset!
Line1)
End If
Its the "objWordDoc.Selection" that fails, object does not support etc
etc.
any ideas?
Keith74 - 05 Jul 2007 11:31 GMT
Ah, got it
objWordDoc.Bookmarks("line1").Range.Paragraphs(1).Range.Delete
thanks to a much earlier post by Jay Freedman
and thanks to you Pranav for your help
Keith
Pranav Vaidya - 05 Jul 2007 11:36 GMT
try using Selection.Delete instead of objWordDoc.Selection.Delete
Regards,
Pranav Vaidya
> Hi there
>
[quoted text clipped - 15 lines]
>
> any ideas?
Keith74 - 05 Jul 2007 17:35 GMT
I think Selection.delete only works on the active document. If the
user opens up another document while the code is running (its a long
process) the new document becomes the active one and the code explodes
in nasty messy fragments as it can't find the bookmarks