Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 1st, 2006, 12:04 AM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
Question VB for Apps - Word Macro Question

I have a table in my Word document (Table1). How do I code my macro to select the first or last row? Thank you.

Reply With Quote
  #2  
Old November 1st, 2006, 02:56 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
I found the answer in another forum:

Dim oTable As Table
Dim rngRow As Range
Dim iRow As Integer
Set oTable = ActiveDocument.Tables(1)
iRow = oTable.Rows.Count
Set rngRow = oTable.Rows(iRow).Range
rngRow.Collapse direction:=wdCollapseStart

Reply With Quote
  #3  
Old November 1st, 2006, 03:14 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
... Now I just need to figure out how to move to the next cell. Ideas?

Reply With Quote
  #4  
Old November 1st, 2006, 07:29 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
The following works better because it does not require the insertion point to be in the table for it to work:

Dim oTable As Table
Dim rngRow As Range
Dim iRow As Integer
Set oTable = ActiveDocument.Tables(1)
iRow = oTable.Rows.Count
Set rngRow = oTable.Rows(iRow).Range
ActiveDocument.Tables(1).Rows(iRow).Select
Selection.InsertRowsBelow

Now, how do I move from cell to cell? I'm still working on this... Any ideas?

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > VB for Apps - Word Macro Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT