Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-19-2013, 11:17 AM
SuzeG SuzeG is offline Adding Rows to a Table Windows 7 64bit Adding Rows to a Table Office 2010 64bit
Novice
Adding Rows to a Table
 
Join Date: Dec 2013
Location: Va Beach
Posts: 21
SuzeG is on a distinguished road
Default Adding Rows to a Table

Hello,
I have code to add 3 content control rows to the end of a table. That code works fine. It is the code to select the table to which the rows are to added that is my problem.
I have several tables in my document and I want the code to pertain to only the 7th table. I tried ActiveDocument.Tables(7) but I get the error "method or data member not found" at the first .Cell(1) line

Also, I am not sure if I have to indicate Tables(7) in the code.

Any help is very much appreciated. Thank you.

Code:
 
 Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
Dim p_oTargetRow As Word.Row
With ActiveDocument.Tables(7)
 ' With Selection.Range
 If .Information(wdWithInTable) Then
' If ContentControl.Range.InRange(.Range) Then
    If .Cells(1).RowIndex = .Tables(1).Range.Cells _
                            (.Tables(1).Range.Cells.Count).RowIndex Then
      If .Cells(1).ColumnIndex = .Tables(1).Range.Cells _
                                 (.Tables(1).Range.Cells.Count).ColumnIndex Then
        If MsgBox("This is the last row/last cell." _
                & " Do  you want to ADD new Performance Goal ROWS?", _
                  vbQuestion + vbYesNo, "New Row") = vbYes Then
          InsertRowWithContent
        End If
        Set p_oTargetRow = Selection.Rows(1)
      End If
    End If
  End If
' End With
End With
End Sub

Reply With Quote
 

Tags
content controls, rows



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Rows to a Table Grouping table rows to prevent individual rows from breaking across pages dennist77 Word 1 10-29-2013 11:39 PM
Adding Rows to a Table Adding rows and copying formulas ejtoll Word Tables 1 12-05-2012 05:09 PM
Adding columns in specific rows only mhays Excel 5 01-17-2012 09:13 AM
Adding Rows to a Table Odd behaviour of table - keep rows together Stephan Lindner Word Tables 1 09-10-2011 05:31 AM
Adding Rows to a Table adding rows to word table hklein Word VBA 4 07-18-2011 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft