Levski
04-03-2005, 08:03 AM
I am opening a document through a com interface that adds a bookmark containing a delimited string, i.e sarah|girl|texas (where | is the delimiter)
What I would like to do on open is to separate the elements and store them as public variables so they can be used by other macros, i.e
Sub Name()
Selection.TypeText Text:=Name
End Sub
would produce Sarah when Name() is called.
It is the document_open macro that I cant get to work -
Sub Document_Open()
Name = Split(Bookmarks("BookMarkName").Range.Text, "|")(0)
Gender = Split(Bookmarks("BookMarkName").Range.Text, "|")(1)
' etc
End Sub
Should assign values to Public Name As String (etc)
But this does not work. When Name() is called nothing happens. No error msg either.
The document_open should conclude with the deletion of the bookmark, but I have yet to get that far.
Can anybody help? If I have gone about a completely inefficient way I would be happy to change tact entirely.
Thank you in advance.
What I would like to do on open is to separate the elements and store them as public variables so they can be used by other macros, i.e
Sub Name()
Selection.TypeText Text:=Name
End Sub
would produce Sarah when Name() is called.
It is the document_open macro that I cant get to work -
Sub Document_Open()
Name = Split(Bookmarks("BookMarkName").Range.Text, "|")(0)
Gender = Split(Bookmarks("BookMarkName").Range.Text, "|")(1)
' etc
End Sub
Should assign values to Public Name As String (etc)
But this does not work. When Name() is called nothing happens. No error msg either.
The document_open should conclude with the deletion of the bookmark, but I have yet to get that far.
Can anybody help? If I have gone about a completely inefficient way I would be happy to change tact entirely.
Thank you in advance.