Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Cross Referencing bookmarks created by a Userform
Hi all,
I've created a letter which pops up a Userform which the user completes and the information is inserted into the letter. Rather than create multiple bookmarks in the letter for the user's name (ie multiple entries of the same data in the userform), I've thought about cross-referencing a single bookmark and have that information inserted at multiple points in the document. This is where the problem starts. I insert a cross reference into the document (stating that it is Reference Type: Bookmark and Insert reference to: Bookmark text) ...nothing comes up to show that a cross-reference is inserted (as a bookmark would show - is this normal?) also, when I run the document using the Userform I get blank fields as a result. Any assistance would be appreciated!! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Cross Referencing bookmarks created by a Userform
It could be that the insertion is overwriting the bookmark. See
http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Hi all, I've created a letter which pops up a Userform which the user completes and the information is inserted into the letter. Rather than create multiple bookmarks in the letter for the user's name (ie multiple entries of the same data in the userform), I've thought about cross-referencing a single bookmark and have that information inserted at multiple points in the document. This is where the problem starts. I insert a cross reference into the document (stating that it is Reference Type: Bookmark and Insert reference to: Bookmark text) ...nothing comes up to show that a cross-reference is inserted (as a bookmark would show - is this normal?) also, when I run the document using the Userform I get blank fields as a result. Any assistance would be appreciated!! |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Cross Referencing bookmarks created by a Userform
Thanks Suzanne,
I'm a little bit of a novice when it comes to Userforms....Would you add your code within the Private Sub CommandBUtton1_Click() code but before the userform bookmarks being activated (as below) or would you run it at the end? Would my coding look like this from the CommandButton? I feel there is much to learn about the Userform/bookmark process....(I'm sure you are rolling your eyes as you say "Uh huh!!" Thanks for your help. _____________________________________ Private Sub CommandButton1_Click() Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String) Dim BMRange As Range Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range BMRange.Text = TextToUse ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange End Sub With ActiveDocument ..Bookmarks("Officer_firstname").Range _ ..InsertBefore TextBox1 ..Bookmarks("Officer_familyname").Range _ ..InsertBefore TextBox2 ..Bookmarks("Officer_telephone").Range _ ..InsertBefore TextBox3 ..Bookmarks("Officer_phoneextension").Range _ ..InsertBefore TextBox4 ..Bookmarks("Officer_emailname").Range _ ..InsertBefore TextBox5 ..Bookmarks("Client_title").Range _ ..InsertBefore TextBox6 ..Bookmarks("Client_firstname").Range _ ..InsertBefore TextBox7 ..Bookmarks("Client_familyname").Range _ ..InsertBefore TextBox8 ..Bookmarks("Todays_date").Range _ ..InsertBefore TextBox9 End With UserForm2.Hide End Sub "Suzanne S. Barnhill" wrote: It could be that the insertion is overwriting the bookmark. See http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Hi all, I've created a letter which pops up a Userform which the user completes and the information is inserted into the letter. Rather than create multiple bookmarks in the letter for the user's name (ie multiple entries of the same data in the userform), I've thought about cross-referencing a single bookmark and have that information inserted at multiple points in the document. This is where the problem starts. I insert a cross reference into the document (stating that it is Reference Type: Bookmark and Insert reference to: Bookmark text) ...nothing comes up to show that a cross-reference is inserted (as a bookmark would show - is this normal?) also, when I run the document using the Userform I get blank fields as a result. Any assistance would be appreciated!! |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Cross Referencing bookmarks created by a Userform
*I* would not do anything since I have no expertise in VBA (and consequently
am not rolling my eyes at all). You might want to post in the microsoft.public.word.vba.userforms newsgroup for more expert help. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Thanks Suzanne, I'm a little bit of a novice when it comes to Userforms....Would you add your code within the Private Sub CommandBUtton1_Click() code but before the userform bookmarks being activated (as below) or would you run it at the end? Would my coding look like this from the CommandButton? I feel there is much to learn about the Userform/bookmark process....(I'm sure you are rolling your eyes as you say "Uh huh!!" Thanks for your help. _____________________________________ Private Sub CommandButton1_Click() Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String) Dim BMRange As Range Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range BMRange.Text = TextToUse ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange End Sub With ActiveDocument .Bookmarks("Officer_firstname").Range _ .InsertBefore TextBox1 .Bookmarks("Officer_familyname").Range _ .InsertBefore TextBox2 .Bookmarks("Officer_telephone").Range _ .InsertBefore TextBox3 .Bookmarks("Officer_phoneextension").Range _ .InsertBefore TextBox4 .Bookmarks("Officer_emailname").Range _ .InsertBefore TextBox5 .Bookmarks("Client_title").Range _ .InsertBefore TextBox6 .Bookmarks("Client_firstname").Range _ .InsertBefore TextBox7 .Bookmarks("Client_familyname").Range _ .InsertBefore TextBox8 .Bookmarks("Todays_date").Range _ .InsertBefore TextBox9 End With UserForm2.Hide End Sub "Suzanne S. Barnhill" wrote: It could be that the insertion is overwriting the bookmark. See http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Hi all, I've created a letter which pops up a Userform which the user completes and the information is inserted into the letter. Rather than create multiple bookmarks in the letter for the user's name (ie multiple entries of the same data in the userform), I've thought about cross-referencing a single bookmark and have that information inserted at multiple points in the document. This is where the problem starts. I insert a cross reference into the document (stating that it is Reference Type: Bookmark and Insert reference to: Bookmark text) ...nothing comes up to show that a cross-reference is inserted (as a bookmark would show - is this normal?) also, when I run the document using the Userform I get blank fields as a result. Any assistance would be appreciated!! |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Cross Referencing bookmarks created by a Userform
Suzanne,
Thanks for that.... I'm an 'expert' (I use that term very loosely) in many things related to Office (to a point)....But when I start playing with VBA macro writing with User forms I've certainly hit that point. Oh well, it's all about learning isn't it? When I find my answer I'll attach it to this thread so that you've the opportunity to add it to you arsenal of knowledge. Thanks once again. - Darren "Suzanne S. Barnhill" wrote: *I* would not do anything since I have no expertise in VBA (and consequently am not rolling my eyes at all). You might want to post in the microsoft.public.word.vba.userforms newsgroup for more expert help. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Thanks Suzanne, I'm a little bit of a novice when it comes to Userforms....Would you add your code within the Private Sub CommandBUtton1_Click() code but before the userform bookmarks being activated (as below) or would you run it at the end? Would my coding look like this from the CommandButton? I feel there is much to learn about the Userform/bookmark process....(I'm sure you are rolling your eyes as you say "Uh huh!!" Thanks for your help. _____________________________________ Private Sub CommandButton1_Click() Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String) Dim BMRange As Range Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range BMRange.Text = TextToUse ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange End Sub With ActiveDocument .Bookmarks("Officer_firstname").Range _ .InsertBefore TextBox1 .Bookmarks("Officer_familyname").Range _ .InsertBefore TextBox2 .Bookmarks("Officer_telephone").Range _ .InsertBefore TextBox3 .Bookmarks("Officer_phoneextension").Range _ .InsertBefore TextBox4 .Bookmarks("Officer_emailname").Range _ .InsertBefore TextBox5 .Bookmarks("Client_title").Range _ .InsertBefore TextBox6 .Bookmarks("Client_firstname").Range _ .InsertBefore TextBox7 .Bookmarks("Client_familyname").Range _ .InsertBefore TextBox8 .Bookmarks("Todays_date").Range _ .InsertBefore TextBox9 End With UserForm2.Hide End Sub "Suzanne S. Barnhill" wrote: It could be that the insertion is overwriting the bookmark. See http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Darren Ingram" wrote in message ... Hi all, I've created a letter which pops up a Userform which the user completes and the information is inserted into the letter. Rather than create multiple bookmarks in the letter for the user's name (ie multiple entries of the same data in the userform), I've thought about cross-referencing a single bookmark and have that information inserted at multiple points in the document. This is where the problem starts. I insert a cross reference into the document (stating that it is Reference Type: Bookmark and Insert reference to: Bookmark text) ...nothing comes up to show that a cross-reference is inserted (as a bookmark would show - is this normal?) also, when I run the document using the Userform I get blank fields as a result. Any assistance would be appreciated!! |
#6
|
|||
|
|||
Hi Darren
I am facing a similar situation, that when I enter info into my userform, it gets inserted into the bookmark, but not at any cross-reference places I have put in with that bookmark. I would like a little help here, as I have to go further, and then auto insert an answer to a question on form, if the checkbox is checked. thanks Quote:
|
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cross referencing | Microsoft Word Help | |||
Cross Referencing Bookmarks | Microsoft Word Help | |||
Cross Referencing Mailmerge Bookmarks | Mailmerge | |||
Referencing bookmarks in Word 2003 - how do I NOT bring the font i | Microsoft Word Help | |||
Bookmarks and cross-referencing..what am I doing wrong? | New Users |