p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Word VBA (http://p2p.wrox.com/forumdisplay.php?f=231)
-   -   Automate bookmark creation (http://p2p.wrox.com/showthread.php?t=71412)

hogg November 11th, 2008 11:24 AM

Automate bookmark creation
Hey all!

I'm after a VBA code to automatically bookmark each cell in a table with a prefix and the relevant row number, so that:
prefix = Alpha
row1 = "alpha"&"1"
row2 = "alpha"&"2"

Any help would be much appreciated!

Shasur November 12th, 2008 04:35 AM


Here is a hint:


Sub Bkmk_Tables()

Dim oTable As Table
Dim i1 As Integer

If ActiveDocument.Tables.Count = 0 Then Exit Sub
Set oTable = ActiveDocument.Tables(1)

For i1 = 1 To oTable.Rows.Count

    ActiveDocument.Bookmarks.Add "Alpha" & i1, oTable.Rows(i1)
Next i1

End Sub


C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)

All times are GMT -4. The time now is 09:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.