A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro to landscape a table



 
 
Thread Tools Display Modes
  #1  
Old October 9th, 2007, 10:29 PM posted to microsoft.public.word.tables
ion[_2_]
external usenet poster
 
Posts: 3
Default Macro to landscape a table

I just found out that one of the abilities Word 2007 stripped me of
was that of putting a landscape formatted section in the middle of a
portrait document. I wrote a macro that will find the first table
following a selection and make it landscape. Enjoy!


Sub LandscapeFollowingTable()
Dim sec As Word.Section, rng As Word.Range
Set rng = Selection.Range
'find the next table -- I'd find the enclosing table if I could
Set rng = rng.Next(wdTable, 1)
'create a section break before the table
Set sec = ActiveDocument.Sections.Add(rng, wdSectionContinuous)
'create a section break after the table
ActiveDocument.Sections.Add rng.Next, wdSectionContinuous
sec.PageSetup.Orientation = wdOrientLandscape
End Sub

  #2  
Old October 10th, 2007, 02:57 AM posted to microsoft.public.word.tables
Jay Freedman
external usenet poster
 
Posts: 9,488
Default Macro to landscape a table

Word 2007 did _not_ remove that ability. As with everything else, it's
just in a different place -- and in this case, not all that different.

After selecting the table, or any other text you want in a landscape
section, click the dialog launcher (the tiny button at the right end
of the group title) of the Page Layout Page Setup group. In the
dialog (which is pretty much just the old File Page Setup dialog),
set the Apply To box to "Selected text" and click the Landscape
button, then OK.

The thing that's different is that there's a separate Orientation
button in the Page Setup group, but that button operates on whatever
is currently chosen in the Apply To box even though you can't see the
dialog. Since that box defaults to "Whole document", clicking the
button without first visiting the dialog will reorient the entire
document even though something is selected. So your macro is useful if
you want to avoid having to go to the dialog.

On Tue, 09 Oct 2007 21:29:03 -0000, ion wrote:

I just found out that one of the abilities Word 2007 stripped me of
was that of putting a landscape formatted section in the middle of a
portrait document. I wrote a macro that will find the first table
following a selection and make it landscape. Enjoy!


Sub LandscapeFollowingTable()
Dim sec As Word.Section, rng As Word.Range
Set rng = Selection.Range
'find the next table -- I'd find the enclosing table if I could
Set rng = rng.Next(wdTable, 1)
'create a section break before the table
Set sec = ActiveDocument.Sections.Add(rng, wdSectionContinuous)
'create a section break after the table
ActiveDocument.Sections.Add rng.Next, wdSectionContinuous
sec.PageSetup.Orientation = wdOrientLandscape
End Sub


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #3  
Old October 12th, 2007, 10:13 PM posted to microsoft.public.word.tables
ion[_2_]
external usenet poster
 
Posts: 3
Default Macro to landscape a table

Thanks, Jay. No one in my office intuited that dialog box, but it's
nice to know there's someone out there who knows this stuff.

I used to be nostalgic for manuals. Now I'm nostalgic for local help.

On Oct 9, 9:57 pm, Jay Freedman wrote:
Word 2007 did _not_ remove that ability. As with everything else, it's
just in a different place -- and in this case, not all that different.

After selecting the table, or any other text you want in a landscape
section, click the dialog launcher (the tiny button at the right end
of the group title) of the Page Layout Page Setup group. In the
dialog (which is pretty much just the old File Page Setup dialog),
set the Apply To box to "Selected text" and click the Landscape
button, then OK.

The thing that's different is that there's a separate Orientation
button in the Page Setup group, but that button operates on whatever
is currently chosen in the Apply To box even though you can't see the
dialog. Since that box defaults to "Whole document", clicking the
button without first visiting the dialog will reorient the entire
document even though something is selected. So your macro is useful if
you want to avoid having to go to the dialog.



On Tue, 09 Oct 2007 21:29:03 -0000, ion wrote:
I just found out that one of the abilities Word 2007 stripped me of
was that of putting a landscape formatted section in the middle of a
portrait document. I wrote a macro that will find the first table
following a selection and make it landscape. Enjoy!


Sub LandscapeFollowingTable()
Dim sec As Word.Section, rng As Word.Range
Set rng = Selection.Range
'find the next table -- I'd find the enclosing table if I could
Set rng = rng.Next(wdTable, 1)
'create a section break before the table
Set sec = ActiveDocument.Sections.Add(rng, wdSectionContinuous)
'create a section break after the table
ActiveDocument.Sections.Add rng.Next, wdSectionContinuous
sec.PageSetup.Orientation = wdOrientLandscape
End Sub


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.



 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.