Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 01-29-2012, 11:41 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline How to select the first row of the current table Windows XP How to select the first row of the current table Office 2007
Competent Performer
How to select the first row of the current table
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

I am making progress, but have run into a couple of puzzling results.

I wanted to use this same syntax to change the font and the borders. I started by capturing the code using the recorder. This is what I got:

Code:
Sub Macro1()
  Selection.Font.Name = "Calibri"
  Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
  Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
End Sub
Then I tried to adapt it to my macro.

For the font change line, I got a Compile error: "Methor or data member not found".

For the last two lines of the border settings, I got a Runtime error '5941': "The requested member of the collection does not exist".

These lines are shown in red and commented out.

Code:
With Selection.Tables(1)
  .Rows.AllowBreakAcrossPages = False
  .AllowAutoFit = False
  .Rows(1).HeadingFormat = SettingHeaderRow
'  .Font.Name = "Calibri"
  If SettingHeaderBorderOff Then  'Turn all but bottom border off
    With Selection.Tables(1).Rows(1)
      .Borders(wdBorderTop).LineStyle = wdLineStyleNone
      .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
      .Borders(wdBorderRight).LineStyle = wdLineStyleNone
      .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
'      .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
'      .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
    End With
  End If
End With
What am I doing wrong?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to select the first row of the current table How to call current PC date and/or current PC year KIM SOLIS Excel 2 11-04-2011 06:09 PM
How to select the first row of the current table Select Text in Table but Table Gets Selected Too RBusiness Word 1 06-07-2011 04:26 PM
How to select the first row of the current table Access to the property of the current table b0x4it Word VBA 2 05-26-2011 06:25 AM
Table - Check Boxes - Create Select All lajohn1963 Word Tables 2 09-25-2010 11:18 AM
How to select the first row of the current table Auto insert current month's name and current year Styler001 Word 4 01-25-2010 06:40 PM

Other Forums: Access Forums

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