make a forms width fit printout

The form is wider than a sheet of paper and not ver tall
I have form that i am trying to avoid making everthing smaller so it can be printed on one sheet of paper
way i see it their are 3 possible solutations
1. redraw all the controls to make them closer together thus making the form more narrow.
Trying to avoid this as many users are using high resolutation and am not sure it will still fit
2. Print the form in Landscape.
Have read where not all printers support Landscape and am not sure if printform can print Landscape
3. Create another form just for printing and copy all the data
Maybe their is another method i have not listed.
Which way would be the best ? and is there another way ?Print problem
isnoend2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Try this project. If you need help in adding its code to your project please let me know.
Wide.zip
0
isnoend2001Author Commented:
Thanks martinLiss, but nothing happens when i click the buttons and Form1 was not added to the project
0
Martin LissOlder than dirtCommented:
Here is a corrected zip file.
Wide.zip
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

isnoend2001Author Commented:
Thanks MartinLiss
I added to print to pdf, so not to waste paper
I will try to modify my project using your code
First thought
does the picturebox cover the whole form with the controls add to the picturebox ?
0
Martin LissOlder than dirtCommented:
does the picturebox cover the whole form with the controls add to the picturebox ?
Sorry but I'm not sure what that means. In any case you could probably have the picturebox be invisible and still print its contents. If you post a zip of your project (or even just the bids form) then I can probably incorporate the code for you.
0
isnoend2001Author Commented:
Thanks martinLiss
EE would not open earlier tried 4-5 times
I attached the zip
I added a print button to get the printers
I always print to pdf when testing
GetBids.zip
0
Martin LissOlder than dirtCommented:
This might take an hour or this might take a day, but I'll get back to you.
0
isnoend2001Author Commented:
no problem
Thank you
0
isnoend2001Author Commented:
Hi MartinLiss i got this code from another site

in bas module
Option Explicit

Private Type GUID
    Data1    As Long
    Data2    As Integer
    Data3    As Integer
    Data4(7) As Byte
End Type

Private Type PicBmp
    Size As Long
    Type As Long
    hBitmap As Long
    hPal As Long
    Reserved As Long
End Type

Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, iPic As IPicture) As Long



Public Function FormToPrint(MyForm As Form) As Picture
Dim FormWidth     As Long
Dim FormHeight    As Long
Dim SourceDC      As Long
Dim MemoryDC      As Long
Dim hBitmap       As Long
Dim hBitmapTemp   As Long

With MyForm
  FormWidth = .ScaleX(.ScaleWidth, .ScaleMode, vbPixels)
  FormHeight = .ScaleY(.ScaleHeight, .ScaleMode, vbPixels)
End With

  SourceDC = MyForm.hdc
  MemoryDC = CreateCompatibleDC(SourceDC)
  hBitmap = CreateCompatibleBitmap(SourceDC, FormWidth, FormHeight)
  hBitmapTemp = SelectObject(MemoryDC, hBitmap)

  BitBlt MemoryDC, 0, 0, FormWidth, FormHeight, SourceDC, 0, 0, vbSrcCopy

  hBitmap = SelectObject(MemoryDC, hBitmapTemp)
 
  DeleteDC MemoryDC
  ReleaseDC MyForm.hwnd, SourceDC

Set FormToPrint = CreateBitmap(hBitmap)
End Function


Private Function CreateBitmap(ByVal hBitmap As Long) As Picture
Dim PIC           As PicBmp
Dim iPic          As IPicture
Dim IID_IDispatch As GUID

  With IID_IDispatch
      .Data1 = &H20400
      .Data4(0) = &HC0
      .Data4(7) = &H46
  End With
 
  With PIC
      .Size = Len(PIC)
      .Type = vbPicTypeBitmap
      .hBitmap = hBitmap
  End With
 
  OleCreatePictureIndirect PIC, IID_IDispatch, 1, iPic

Set CreateBitmap = iPic
End Function


Calling the function:

Sub PrintGetBids()
 Dim Percentage As Double

Percentage = 75 '50 'Set Image scale %
Percentage = Percentage / 100

Printer.ScaleMode = vbTwips
frmPrintGetBids.ScaleHeight
Printer.PaintPicture FormToPrint(frmPrintGetBids), 0, 0, Percentage * frmPrintGetBids.ScaleWidth, Percentage *
Printer.EndDoc
End Sub


This seems to work for the sizing, however Ihave ran into another problem
I will post it in another question
0
Martin LissOlder than dirtCommented:
Before you do that try this project. (You'll need to add the dat file).
Q-28535877.zip
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.