Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2017, 06:28 AM
lodi123 lodi123 is offline Inserting graphic in last table Windows 7 32bit Inserting graphic in last table Office 2010 32bit
Novice
Inserting graphic in last table
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default Inserting graphic in last table

Hi guys,

I'm wondering if there is a possibility to refer to the last table in a Word document.
I need to insert a graphic in the last table, but it is possible that the number of tables inside the document will change. So I can't use the Tables(X) in the code.

Now I got this:
Sub ShowInterim(control As IRibbonControl)

With ActiveDocument
Dim oBB As BuildingBlock
Dim oRng As Range
Dim oField As Field
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter

Set oRng = ActiveDocument.Tables(18).Rows(1).Cells(1).Range
oRng.End = oRng.End - 1 'to exclude the end of cell marker
Set oBB = ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Interim")
oBB.Insert Where:=oRng, RichText:=True
For Each oSection In ActiveDocument.Sections

For Each oHeader In oSection.Headers
If oHeader.Exists Then


For Each oField In oHeader.Range.Fields
oField.Update
Next oField
End If
Next oHeader
Next oSection

End With

End Sub

Is there a possibility like Table(Last) or something to fix this? The last table will also be on the last page of the document, if this helps.
Reply With Quote
  #2  
Old 07-07-2017, 06:38 AM
gmaxey gmaxey is offline Inserting graphic in last table Windows 7 32bit Inserting graphic in last table Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Have you tried:
ActiveDocument.Tables(ActiveDocument.Tables.Count) .Rows(1).Cells(1).Range
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 07-07-2017, 06:48 AM
lodi123 lodi123 is offline Inserting graphic in last table Windows 7 32bit Inserting graphic in last table Office 2010 32bit
Novice
Inserting graphic in last table
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default

Oh wow this is great!! Thank you so much!!
Reply With Quote
Reply

Tags
insert graphic, last page, last table



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting graphic in last table Inserting a table using ADD command snufse Word VBA 1 11-10-2015 03:28 PM
Inserting graphic in last table Inserting arrow images into a table jklein Word Tables 5 06-29-2014 07:40 PM
Inserting graphic in last table Inserting table natasha_arriell Mail Merge 4 06-04-2014 12:13 AM
Convert graphic to text in a table Jennifer Murphy Word 6 01-24-2013 12:56 PM
Inserting a table Katelyn Outlook 0 04-05-2012 09:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:53 PM.


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