Thread: [Solved] VBA scripting / table
View Single Post
 
Old 08-21-2015, 09:07 PM
Guessed's Avatar
Guessed Guessed is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Jennifer

Your code has some unclear bits in it. If you know that the table is always the third one then you simply use that number rather than creating a variable for it.

The following declaration line is probably not giving you what you expect.
Dim vFlag, dummy, xx, yy, zz As Integer

This is a trap for young players but this declares zz as an Integer whilst all the others are of variant type. This matters a lot because the two lines listed in Graham's post assign yy to different things
yy = ActiveDocument.Tables.Count 'this is an integer
yy = ActiveDocument.Tables(1) 'this is a table
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote