-
VB and MS Word document bookmarks
Hello Dan:
I am writing an application that queries a database and pulls up a variant
array of records.
The records (parts of them) are then placed into predefined bookmarks in
an MS Word document.
The number of records returned can be anywhere from 0 to 30 or more, but
I have only a constant number of bookmarks.
I could define a huge number of bookmarks to cover myself, but is there a
way you know of to dynamically create bookmarks in the Word doc depending
on how many records are returned?
Thanks,
Andy
-
Re: VB and MS Word document bookmarks
Sorry, that's way out of my area of expertise. I haven't done VBA word coding
in ages.
Best of luck.
Dan
Andrew Payne wrote:
> Hello Dan:
>
> I am writing an application that queries a database and pulls up a variant
> array of records.
>
> The records (parts of them) are then placed into predefined bookmarks in
> an MS Word document.
>
> The number of records returned can be anywhere from 0 to 30 or more, but
> I have only a constant number of bookmarks.
>
> I could define a huge number of bookmarks to cover myself, but is there a
> way you know of to dynamically create bookmarks in the Word doc depending
> on how many records are returned?
>
> Thanks,
> Andy
-
Re: VB and MS Word document bookmarks
Andrew,
To add a bookmark, you can use either of the following statements:
dim oBmk as Word.Bookmark
dim oRng1 as Word.Range, oRng2 as Word.Range
set oBmk = oRng1.Bookmarks.Add("bmkNew")
set oBmk = oRng1.Bookmarks.Add("bmkNew", oRng2)
Both statements add named "bmkNew". Either range can be collapsed. The
first statement above bookmarks the range identified by oRng1. The second
statment bookmarks the range identifed by oRng2, and oRng1 can refer to any
valid range within the document.
Regards,
Tom.
"Andrew Payne" <schatze@peconic.net> wrote:
>
>Hello Dan:
>
>I am writing an application that queries a database and pulls up a variant
>array of records.
>
>The records (parts of them) are then placed into predefined bookmarks in
>an MS Word document.
>
>The number of records returned can be anywhere from 0 to 30 or more, but
>I have only a constant number of bookmarks.
>
>I could define a huge number of bookmarks to cover myself, but is there
a
>way you know of to dynamically create bookmarks in the Word doc depending
>on how many records are returned?
>
>Thanks,
>Andy
-
Re: VB and MS Word document bookmarks
Thank you, Tom
Andy
"Tom Eubank" <tom@afcon.com> wrote:
>
>Andrew,
>
>To add a bookmark, you can use either of the following statements:
>
> dim oBmk as Word.Bookmark
> dim oRng1 as Word.Range, oRng2 as Word.Range
>
> set oBmk = oRng1.Bookmarks.Add("bmkNew")
> set oBmk = oRng1.Bookmarks.Add("bmkNew", oRng2)
>
>Both statements add named "bmkNew". Either range can be collapsed. The
>first statement above bookmarks the range identified by oRng1. The second
>statment bookmarks the range identifed by oRng2, and oRng1 can refer to
any
>valid range within the document.
>
>Regards,
>Tom.
>
>"Andrew Payne" <schatze@peconic.net> wrote:
>>
>>Hello Dan:
>>
>>I am writing an application that queries a database and pulls up a variant
>>array of records.
>>
>>The records (parts of them) are then placed into predefined bookmarks in
>>an MS Word document.
>>
>>The number of records returned can be anywhere from 0 to 30 or more, but
>>I have only a constant number of bookmarks.
>>
>>I could define a huge number of bookmarks to cover myself, but is there
>a
>>way you know of to dynamically create bookmarks in the Word doc depending
>>on how many records are returned?
>>
>>Thanks,
>>Andy
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|