Reply
 
Thread Tools Display Modes
  #1   Report Post  
PmcPowell PmcPowell is offline
Junior Member
 
Posts: 0
Unhappy Bookmarks in table brings over Table Cell properties

Hi - I've been using another Forum for many years but not getting any help with this problem. Just joined and this is my first post.

I have created a User Input Data Sheet to solicit values from users.
The Table in the Form has 4 Columns: Section, Description, Value and Bookmark Name. All But Value are pre-populated.
When completed I run a macro which takes the Text in the "Value" Column and allocates it to a Bookmark name in the "Bookmark Name" column.

It took me many attempts to get the macro to work but it works now just fine.

Problem:
When I use the Bookmarks in the "Ref" fields of the following pages of the document it brings over the whole cell complete with borders and shading which messes up the document layout.
I've tried everything I know to no avail. I Dim the Bookmark range as Variant as using as Range or as Bookmark gives an Error.
Here is the code:
--------------------------------------------------------------------------------------
Sub Mcr_Set_Bookmarks()
'
' Mcr_Set_Bookmarks Macro
' This Macro Takes the User Inputted Data in the "Value" Column of the Data Sheet Table
' and allocates the Bookmark Name from the "Bookmark Name" Column
Dim BKMkName As Variant
Dim BkmkRange As Variant
Dim BkmkNameLength As Integer
Dim BkmkRangeLength As Integer
Dim rV As Integer
Dim Endrow As Integer
Dim StartRow As Integer
'---------------------------------------------------------------------
On Error Resume Next
StartRow = Val(InputBox("Enter First Row Number Which Contains Data", "First Row"))
Endrow = ActiveDocument.Tables(1).Rows.Count
rV = StartRow
'------------------------------------------------------------------ Loop Through all Values in Table and allocate Bookmarks
For rV = StartRow To Endrow
BkmkNameLength = Len(ActiveDocument.Tables(1).Cell(rV, 4).Range) - 2
BkmkRangeLength = Len(ActiveDocument.Tables(1).Cell(rV, 3).Range) - 2
BKMkName = Left(ActiveDocument.Tables(1).Cell(rV, 4).Range, BkmkNameLength)
Debug.Print BKMkName
BkmkRange = Left(ActiveDocument.Tables(1).Cell(rV, 3), BkmkRangeLength)
ActiveDocument.Tables(1).Cell(rV, 3).Select
ActiveDocument.Bookmarks.Add Name:=BKMkName, Range:=Selection.Range
Next rV

End Sub
------------------------------------------------------------------------------
I've attached a sample of the document with snips showing what I;m talking about.
Hope I have more luck with this Forum than my old one.

Appreciate any help as I'm at my wits end and this is an important project as I'm trying to bring in automation to a group of not very Computer savvy coworkers who could really benefit from this.
Attached Files
File Type: zip Automated_Sttements_Working_v_4.0.zip (77.2 KB, 81 views)
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy calculated total from cell in one table to another table N. Goldberg Mailmerge 0 May 12th 15 04:48 PM
Table field code referencing table cell with text Helge V. Larsen Tables 1 July 16th 09 09:32 AM
Repeat table cell if table spans 2 pages CozmicOne Microsoft Word Help 3 June 17th 09 05:51 PM
copying colour from a table cell to another table cell Purplejopeg Tables 4 February 20th 08 02:34 PM
Table still breaking after table properties and paragraph options. Eric Tables 1 August 16th 06 07:51 PM


All times are GMT +1. The time now is 12:39 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"