Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2014, 02:44 PM
jcorti jcorti is offline Adding information from a array into a table Windows 7 64bit Adding information from a array into a table Office 2013
Novice
Adding information from a array into a table
 
Join Date: Jan 2014
Posts: 1
jcorti is on a distinguished road
Default Adding information from a array into a table

Hi guys i hope this is an easy question to answer because im kinda stumped. Im looking to have an array that will fill out a table after a user selects an option the problem is i dont know how to specify the table to input the data. any help would be greatly appreciated
Reply With Quote
  #2  
Old 01-10-2014, 03:21 PM
macropod's Avatar
macropod macropod is offline Adding information from a array into a table Windows 7 32bit Adding information from a array into a table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Simple:
Code:
With ActiveDocument.Tables(#)
  'updating code goes here
End with
where # is the table's index number.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-10-2014, 05:42 PM
fumei fumei is offline Adding information from a array into a table Windows 7 64bit Adding information from a array into a table Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Just to emphasis a point; the index number of the table collection is the ORDER in the document. A table does not have an explicit index number. Or rather, it does have an explicit number, but the number is derived dynamically from the order the table is in. So if Tables(4) has a table inserted before it, it is now Tables(5). And if Tables(4) is moved after Tables (7), it now becomes Tables(7) - as Tables(7) becomes Tables(6), because Tables(4) is no longer there.
Reply With Quote
  #4  
Old 01-10-2014, 05:52 PM
fumei fumei is offline Adding information from a array into a table Windows 7 64bit Adding information from a array into a table Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Or (and I prefer this), if your tables are bookmarked you can point to a table by name, and it does not matter where they are in the document; nor does it matter if other tables are inserted; nor does it matter if they are ever moved. The index number is not needed, nor used.
Reply With Quote
  #5  
Old 01-10-2014, 10:58 PM
macropod's Avatar
macropod macropod is offline Adding information from a array into a table Windows 7 32bit Adding information from a array into a table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by fumei View Post
Or (and I prefer this), if your tables are bookmarked you can point to a table by name
For that you'd use code like:
Code:
With ActiveDocument.Bookmarks("MyBookmark").Range.Tables(1)
  'updating code goes here
End with
where "MyBookmark" is the table's bookmark name.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding information from a array into a table Adding Rows to a Table SuzeG Word VBA 8 01-02-2014 08:05 AM
Adding a border to every nth row of a word table hummus_it Word VBA 4 10-04-2013 03:59 PM
Adding information from a array into a table Convert String Array to Integer Array from a User Input? tinfanide Excel Programming 4 12-26-2012 08:56 PM
Adding information from a array into a table adding table to a particular place hklein Word VBA 2 07-25-2011 01:45 AM
Adding information from a array into a table Adding a Total row to pivot Table hannu Excel 1 09-18-2010 01:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:55 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