+ Reply to Thread
Results 1 to 9 of 9

Userform - Printing

Hybrid View

  1. #1
    Greg B
    Guest

    Re: Userform - Printing

    Thanks for your help but it is not working right.

    I have a userform called "totals" It shows all the information in a nice
    layout.

    The trouble is it continues to print in portrait even when the settings are
    set at landscape.

    Is it possible to print a userform in landscape? Is there a setting I am
    not using.

    Thanks again
    Greg



  2. #2
    Bob Phillips
    Guest

    Re: Userform - Printing

    Greg,

    Here is a technique that does work (I tested it :-) which Tom Oguily posted
    some time back

    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
    ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


    Private Const VK_SNAPSHOT = 44
    Private Const VK_LMENU = 164
    Private Const KEYEVENTF_KEYUP = 2
    Private Const KEYEVENTF_EXTENDEDKEY = 1



    Private Sub cmdPrint_Click()
    ' keybd_event VK_SNAPSHOT, 0, 0, 0
    DoEvents
    keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0
    keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
    keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _
    KEYEVENTF_KEYUP, 0
    keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _
    KEYEVENTF_KEYUP, 0
    DoEvents
    Workbooks.Add
    Application.Wait Now + TimeValue("00:00:01")
    ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False,
    DisplayAsIcon:=False
    ActiveSheet.PageSetup.Orientation = xlLandscape
    ActiveSheet.Range("A1").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    ActiveWorkbook.Close Savechanges:=False
    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Greg B" <browshop@ihug.com.au> wrote in message
    news:d11bvg$n1b$1@lust.ihug.co.nz...
    > Thanks for your help but it is not working right.
    >
    > I have a userform called "totals" It shows all the information in a nice
    > layout.
    >
    > The trouble is it continues to print in portrait even when the settings

    are
    > set at landscape.
    >
    > Is it possible to print a userform in landscape? Is there a setting I am
    > not using.
    >
    > Thanks again
    > Greg
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1