X
XmlAdoNewbie
Hi All,
I am creating a document builder in vba and word 2002. When i run my
code from a file with the extension .doc everything is fine, however i
have just created a template from the same document and my code blows
up when i try and select a range. I get a 'run time error 4608 - value
out of range' message. The code it blows up on is the following.
Public Sub returnText(ByVal childnode As IXMLDOMNode)
Dim temp As String
Selection.GoTo what:=wdGoToBookmark, Name:="A"
Selection.InsertFile FileName:=path & childnode.text
BookMarkStart = ActiveDocument.Bookmarks("A").Start
BookMarkEnd = Len(ActiveDocument.Content) - 1
Set myRange = ThisDocument.Range(Start:=BookMarkStart,
End:=BookMarkEnd)
myRange.Copy
End Sub
it doesn't like the line
Set myRange = ThisDocument.Range(Start:=BookMarkStart,
End:=BookMarkEnd)
bookmarkstart and bookmarkend seem to be proper values and like i said
before it works when the file has a .doc extension
Is there any reason this may be happening?? Any help will be greatly
appreciated!!
Thanks so much in advance!
Erin
I am creating a document builder in vba and word 2002. When i run my
code from a file with the extension .doc everything is fine, however i
have just created a template from the same document and my code blows
up when i try and select a range. I get a 'run time error 4608 - value
out of range' message. The code it blows up on is the following.
Public Sub returnText(ByVal childnode As IXMLDOMNode)
Dim temp As String
Selection.GoTo what:=wdGoToBookmark, Name:="A"
Selection.InsertFile FileName:=path & childnode.text
BookMarkStart = ActiveDocument.Bookmarks("A").Start
BookMarkEnd = Len(ActiveDocument.Content) - 1
Set myRange = ThisDocument.Range(Start:=BookMarkStart,
End:=BookMarkEnd)
myRange.Copy
End Sub
it doesn't like the line
Set myRange = ThisDocument.Range(Start:=BookMarkStart,
End:=BookMarkEnd)
bookmarkstart and bookmarkend seem to be proper values and like i said
before it works when the file has a .doc extension
Is there any reason this may be happening?? Any help will be greatly
appreciated!!
Thanks so much in advance!
Erin