KVT Holland
New Member
- Joined
- May 10, 2017
- Messages
- 21
Hi,
I made a macro that creates a new word document and then copies a range in to it.
Is there a way to change the layout of the word to landscape and scale the range that
has to copied down to fit on a A4?
All i can find is how to open an existing file with the proper settings. The bosmen however
wants to able to use the Excel workbook everywhere without having a template .
The code i use is
I've been trying to ad
And I've tried this
But i have no idea what to ad in the "??????????" on the second piece of code i dont know how to ge vba to select word doc and then change it to landscape.
I have tried to ad "AutoFitBehavior wdAutoFitWindow" but i cant see i understand it.
I hope you guys can help me,
Koen.
I made a macro that creates a new word document and then copies a range in to it.
Is there a way to change the layout of the word to landscape and scale the range that
has to copied down to fit on a A4?
All i can find is how to open an existing file with the proper settings. The bosmen however
wants to able to use the Excel workbook everywhere without having a template .
The code i use is
Code:
Private Sub CommandButton8_Click() Range("Kleur").Interior.ColorIndex = 0
Dim WdObj As Object
Set WdObj = CreateObject("Word.Application")
WdObj.Visible = True
Range("Print").Copy
WdObj.Documents.Add
WdObj.Selection.PasteSpecial Link:=False
Range("Kleur").Interior.ColorIndex = 6
End Sub
I've been trying to ad
Code:
[COLOR=#101094][FONT=inherit]Set[/FONT][/COLOR][COLOR=#303336][FONT=inherit] wdDoc [/FONT][/COLOR][COLOR=#303336][FONT=inherit]=[/FONT][/COLOR][COLOR=#303336][FONT=inherit] wdApp[/FONT][/COLOR][COLOR=#303336][FONT=inherit].[/FONT][/COLOR][COLOR=#303336][FONT=inherit]Documents[/FONT][/COLOR][COLOR=#303336][FONT=inherit].[/FONT][/COLOR][COLOR=#303336][FONT=inherit]Open[/FONT][/COLOR][COLOR=#303336][FONT=inherit]([/FONT][/COLOR][COLOR=#303336][FONT=inherit]Range[/FONT][/COLOR][COLOR=#303336][FONT=inherit]([/FONT][/COLOR][COLOR=#7D2727][FONT=inherit]"??????????"[/FONT][/COLOR][COLOR=#303336][FONT=inherit]).[/FONT][/COLOR][COLOR=#303336][FONT=inherit]Value[/FONT][/COLOR][COLOR=#303336][FONT=inherit])
[/FONT][/COLOR]
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">[COLOR=#303336][FONT=inherit]
wdDoc[/FONT][/COLOR][COLOR=#303336][FONT=inherit].[/FONT][/COLOR][COLOR=#303336][FONT=inherit]PageSetup[/FONT][/COLOR][COLOR=#303336][FONT=inherit].[/FONT][/COLOR][COLOR=#303336][FONT=inherit]Orientation [/FONT][/COLOR][COLOR=#303336][FONT=inherit]=[/FONT][/COLOR][COLOR=#303336][FONT=inherit] wdOrientLandscape[/FONT][/COLOR]</code>
And I've tried this
Code:
Selection.PageSetup.Orientation = wdOrientLandscape
But i have no idea what to ad in the "??????????" on the second piece of code i dont know how to ge vba to select word doc and then change it to landscape.
I have tried to ad "AutoFitBehavior wdAutoFitWindow" but i cant see i understand it.
I hope you guys can help me,
Koen.
Last edited: