Re: Setting Page Width, Height, and Orientation by Russ
Russ
Sun Aug 13 23:12:05 CDT 2006
"rmcompute",
You might have left...
Application.ScreenUpdating = False
...in the VBA code and you don't see any results until the screen is
refreshed manually.
If that was the problem, you can also use "Application.Refresh" to
momentarily refresh things within a program and then use
"Application.ScreenUpdating = True" at the end of the program.
> If I go into Word and manually do this process I would do the following:
>
> 1) Click File/Page Setup .../
>
> 2) On the Margins Tab, Click Portrait for Orientation.
>
> 3) On the Paper Tab, Click Letter (8.5 x 11 in) For Papersize.
>
> 4) Click OK to return to the document.
>
> Since I am trying to programatically save an Access report as a Word
> document, I had to create an instance of the report in Word and then change
> its properties:
> With wdApp.ActiveDocument.PageSetup
> .PageWidth = InchesToPoints(8.5)
> .PageHeight = InchesToPoints(11)
> Orientation = wdOrientPortrait
> End With
>
> When I manually went into this document I was able to verify that these
> items were changed, however, the document's appearance remained the same. It
> was only after clicking OK that the changes took. I was wondering if there
> was a way to simulate this with VBA code.
>
> "Jezebel" wrote:
>
>> Click OK on what?
>
>
>
>
>
>>
>> However, a simpler approach for you is to create a template that is already
>> set up as you need, then use that to create the report.
>>
>>
>>
>> "rmcompute" <rmcompute@discussions.microsoft.com> wrote in message
>> news:716194CA-E01D-4476-BEF2-C37697C0A4D6@microsoft.com...
>>> I created an Access report and saved it as a word document. I then set the
>>> Page Width, Page Height and Orientation. When I checked the document
>>> under
>>> page set up all of the set parameters were there but they don't seem to
>>> take
>>> effect until I click OK. Is there some command that can simulate OK in
>>> the
>>> commands listed below ?
>>>
>>> Set docSource = wdApp.Documents.Open(strReportRtf)
>>> With wdApp.ActiveDocument.PageSetup
>>> .PageWidth = InchesToPoints(dRptWidth)
>>> .PageHeight = InchesToPoints(dRptHeight)
>>> If strRptOrient = "P" Then
>>> .Orientation = wdOrientPortrait
>>> Else
>>> .Orientation = wdOrientLandscape
>>> End If
>>> End With
>>> docSource.SaveAs FileName:=strReportDoc,
>>> FileFormat:=wdFormatDocument
>>> docSource.Close
>>>
>>
>>
>>
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID