Mar 28th, 2007, 10:48 AM
#1
Thread Starter
New Member
VB Code to Print Landscape
Hi there,
Does anyone know the VB 6 code for printing landscape.
Have tried: but doesnt seem to work.
cmdPrint.DefaultPageSettings.Landscape = True
Mar 28th, 2007, 11:53 AM
#2
Re: VB Code to Print Landscape
Is cmdPrint as command button? If so, there is no sub property as DeffaultPageSettings with a command button.
In VB6, user the Printer Object, and you can set its Orientation method to landscape. Example:
Code:
Printer.FontName = "arial"
Printer.FontUnderline = True
Printer.FontSize = 8
Printer.Orientation = vbPRORLandscape
'etc
Mar 28th, 2007, 12:31 PM
#3
Thread Starter
New Member
Re: VB Code to Print Landscape
Originally Posted by
Hack
Is cmdPrint as command button? If so, there is no sub property as DeffaultPageSettings with a command button.
In VB6, user the Printer Object, and you can set its Orientation method to landscape. Example:
Code:
Printer.FontName = "arial"
Printer.FontUnderline = True
Printer.FontSize = 8
Printer.Orientation = vbPRORLandscape
'etc
Hi there Hack,
Yes it is a Command Button. I have Print in the Mnu, but i wanted the Quick Print Command button to print what i can see.
See attached the .exe for my project.
Jon
Last edited by RobDog888; Mar 29th, 2007 at 12:22 AM .
Reason: Removed exe zip attachment
Mar 28th, 2007, 12:38 PM
#4
Re: VB Code to Print Landscape
There is absolutely no way that I, or anyone else, is going to down load a zip file with nothing but an .Exe file in it.
First off, I can't tell anything without looking at the source code, but far more importantly, I have no idea what that .exe does, and no intention of finding out.
Attach your source code or post it.
Mar 28th, 2007, 12:40 PM
#5
Thread Starter
New Member
Re: VB Code to Print Landscape
Ok...fair enough...viruses and all that.
See attached the form file
Attached Files
Mar 28th, 2007, 12:44 PM
#6
Re: VB Code to Print Landscape
I have seen this form before.
Now, your original question was just how do you print landscape.
What is it that you want to print. The Form itself? (very easy)
Mar 28th, 2007, 02:09 PM
#7
Thread Starter
New Member
Re: VB Code to Print Landscape
Yes the form....The Print in the Menu bit at the top is coded to do a VB Customised Print.
What i want is that it shows the whole screen (as if it was a print screen on the program)
Can you help??
Mar 28th, 2007, 05:19 PM
#8
Thread Starter
New Member
Re: VB Code to Print Landscape
Mar 29th, 2007, 12:26 AM
#9
Re: VB Code to Print Landscape
Exe attachment removed in post #3.
To answer the first question: Tell the Printer object to print landscape.
Printer.Orientation = vbPRORLandscape
If you want to print a screenshot then you could use the keybd_event API to invoke the PrintScreen button and copy the screenshot to the clipboard. Then paste it into a hidden picturebox. Finally print the picturebox.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Mar 29th, 2007, 03:00 AM
#10
Thread Starter
New Member
Re: VB Code to Print Landscape
Ok, how can i code that?? It looks pretty straight forward, but i am not that experienced.
Mar 29th, 2007, 03:43 AM
#11
Re: VB Code to Print Landscape
Here is the API definition. You can get it and allot of others if you download the api viewer utility (link in my signature).
There are several code examples already on the forums if you need more.
vb Code:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'And Const
Private Const VK_SNAPSHOT As Long = &H2C
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width