Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-08-2015, 08:17 AM
ksigcajun ksigcajun is offline Code to add new row in table Windows 7 64bit Code to add new row in table Office 2010 64bit
Advanced Beginner
Code to add new row in table
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default Code to add new row in table

I initially wanted this code to prompt for the addition of a new row in a table. What the easiest way to change the code where it only prompts in one specific table and not every table in my word document.

Do I need to name the specific table somehow first?

Thanks for the help!

PHP Code:
Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
With Selection.Range
  
If .Information(wdWithInTableThen
    
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(" Do you want to add a new row to the table?"_
                  vbQuestion 
vbYesNo"Question") = vbYes Then
          InsertRowWithContent
        End 
If
        
Set p_oTargetRow Selection.Rows(1)
      
End If
    
End If
  
End If
End With
End Sub 
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to add new row in table Colour code mail merge header table cell backgrounds ScotsMaverick Mail Merge 25 11-04-2021 02:07 PM
Code to add new row in table Code to disable spacing between cells in table properties bloomhaven Word VBA 3 03-11-2015 04:08 PM
Creating VBA Code to Delete Empty Column in Table Faugs Word VBA 5 08-07-2014 03:29 PM
Code to add new row in table VBA Code to take data from a table in word document and place it in a summary table VBLearner Word VBA 1 03-09-2014 08:42 PM
VBA sort table code mikec Excel Programming 8 10-01-2013 04:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:57 PM.


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