Page-Setup Orientation - Landscape

T

Torsten Hansen

Hello,

I want to start Word from another programm (Excel, Access, FrontPage...)
with a little makro and set the orientation in the PageSetup-Menue on
"Landscape", but it doesn't work.
Word starts but the orientation has not been set on "Landscape".
Does anybody know what's wrong in my makro?

Sub Test()
Dim WordObj As Object
Dim WordDoc As Object
On Error Resume Next
Set WordObj = GetObject(, "Word.Application.10")
If Err.Number = 429 Then
Set WordObj = CreateObject("Word.Application.10")
Err.Number = 0
End If
WordObj.Visible = True
Set WordDoc = WordObj.Documents.Add

WordObj.ActiveDocument.PageSetup.Orientation = wdOrientLandscape

Set WordDoc = Nothing
Set WordObj = Nothing
End Sub
 
D

Doug Robbins - Word MVP

Duplicate post answered in microsoft.public.word.vba.general

Please do not spam the newsgroups by posting the same question separately to
multiple newsgroups. Rather, if you are not sure which is the most
appropriate newsgroup, insert the names of those which you think might be
appropriate into the header of a single message. When you do that, an
answer in one newsgroup will automatically appear in all of the newsgroups
to which you posted. That will make it easier for you to find responses and
can also reduce the possibility of someone developing an answer to a
question that has already been answered.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top