Range Class in classic ASP

Hi all,

I have a problem access the range class from classic asp. I try to load a template, replace the Bookmarks and svae the Document. book_test is the name of the Bookmark and should be replace by test2.

Unbenanntes Dokument

<%

Dim helper
Set helper = CreateObject("Aspose.Words.ComHelper")
Dim doc
Set doc = helper.Open("C:\test-template.doc")

doc.Range.Bookmarks "book_test"
doc.Range.Text = "test2"

doc.Save "C:\test.doc"

%>

Hi

Thanks for your inquiry. You should use code like the following to set bookmark’s text from COM:

' Open document
Dim helper
Set helper = CreateObject("Aspose.Words.ComHelper")
Dim doc
Set doc = helper.Open("C:\Temp\in.doc")

' Set bookmark's text.
doc.Range.Bookmarks.Item_2("myBookmark").Text = "test"
' Save output document
doc.Save("C:\Temp\out.doc")

Hope this helps.
Best regards,