Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

VBA - selects current table cursor is in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fred - 15 Aug 2006 14:37 GMT
Also require macro that will select all but first row of table cursor is
positioned in:

Sub TableExcept1stRow()

ActiveDocument.Tables(1).Select
Selection.SetRange _
       Start:=Selection.Rows(2).Range.Start, _
       End:=Selection.End

End Sub

Thank you.
Helmut Weber - 15 Aug 2006 15:11 GMT
Hi Fred

how about this,
which would include the end of row mark.
With vertically merged cells things would be different.

Sub Test004567()
Dim rngTmp As Range
Set rngTmp = selection.Tables(1).Range
rngTmp.start = rngTmp.Rows(2).Cells(1).Range.start
rngTmp.Select
End Sub

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Fred - 15 Aug 2006 21:55 GMT
Does trick - thanks Helmut.

> Hi Fred
>
[quoted text clipped - 8 lines]
> rngTmp.Select
> End Sub
Greg Maxey - 15 Aug 2006 15:36 GMT
Try:
Sub Scratchmacro()
Dim oRng As Word.Range
If Selection.Information(wdWithInTable) Then
 Set oRng = Selection.Range
 With oRng
   .Start = Selection.Tables(1).Rows(2).Range.Start
   .End = Selection.Tables(1).Rows.Last.Range.End
   .Select
 End With
Else
 MsgBox "The selection is not in a table"
End If
End Sub

> Also require macro that will select all but first row of table cursor is
> positioned in:
[quoted text clipped - 9 lines]
>
> Thank you.
Fred - 15 Aug 2006 21:56 GMT
Thanks Greg also does the trick.
> Try:
> Sub Scratchmacro()
[quoted text clipped - 24 lines]
>>
>> Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.