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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|