A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Bookmarks in table brings over Table Cell properties



 
 
Thread Tools Display Modes
  #1  
Old November 10th 19, 06:36 PM
PmcPowell PmcPowell is offline
Junior Member
 
First recorded activity by WordBanter: Nov 2019
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, 6 views)
Ads
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
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 02:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.