![]() |
Excel create bookmark
This code is trying to create a bookmark in Word from Excel,
The problem is it creates a bookmark that is the whole document rather than just the text <Insert link here Any ideas how to fix this? Thanks, With WordDoc.Content.Find .text = "<Insert link here" If .Execute Then WordDoc.Bookmarks.Add Name:="bmRlsPlan", Range:=WordDoc.Content End If End With |
Excel create bookmark
You might get more help in the Word programming newsgroup, but the
following may work for you: '=============== Dim rngFind As Range Set rngFind = WordDoc.Content With rngFind.Find .Text = "<Insert link here" If .Execute Then rngFind.Bookmarks.Add _ Name:="bmRlsPlan", Range:=rngFind End If End With '========================= Shawn G. wrote: This code is trying to create a bookmark in Word from Excel, The problem is it creates a bookmark that is the whole document rather than just the text <Insert link here Any ideas how to fix this? Thanks, With WordDoc.Content.Find .text = "<Insert link here" If .Execute Then WordDoc.Bookmarks.Add Name:="bmRlsPlan", Range:=WordDoc.Content End If End With -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Excel create bookmark
This line gives an error, Compile error: Argument not optional
Any way around this? With rngFind.Find thanks, "Debra Dalgleish" wrote: You might get more help in the Word programming newsgroup, but the following may work for you: '=============== Dim rngFind As Range Set rngFind = WordDoc.Content With rngFind.Find .Text = "<Insert link here" If .Execute Then rngFind.Bookmarks.Add _ Name:="bmRlsPlan", Range:=rngFind End If End With '========================= Shawn G. wrote: This code is trying to create a bookmark in Word from Excel, The problem is it creates a bookmark that is the whole document rather than just the text <Insert link here Any ideas how to fix this? Thanks, With WordDoc.Content.Find .text = "<Insert link here" If .Execute Then WordDoc.Bookmarks.Add Name:="bmRlsPlan", Range:=WordDoc.Content End If End With -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Excel create bookmark
Change the first line to:
Dim rngFind As Word.Range and it should work correctly. Shawn G. wrote: This line gives an error, Compile error: Argument not optional Any way around this? With rngFind.Find thanks, "Debra Dalgleish" wrote: You might get more help in the Word programming newsgroup, but the following may work for you: '=============== Dim rngFind As Range Set rngFind = WordDoc.Content With rngFind.Find .Text = "<Insert link here" If .Execute Then rngFind.Bookmarks.Add _ Name:="bmRlsPlan", Range:=rngFind End If End With '========================= Shawn G. wrote: This code is trying to create a bookmark in Word from Excel, The problem is it creates a bookmark that is the whole document rather than just the text <Insert link here Any ideas how to fix this? Thanks, With WordDoc.Content.Find .text = "<Insert link here" If .Execute Then WordDoc.Bookmarks.Add Name:="bmRlsPlan", Range:=WordDoc.Content End If End With -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 01:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com