Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Printing userforms

Hi there,
I searched the board but could not find a post concerning a problem I face.
Its probably simple and silly but still a problem for me...

I have a userform which occupies the whole screen when the workbook is
opened. I try to print it (I can even live with only printing the image on it
-image1- ). I found a way:
userform1.printform

but this only prints part of it and I want a landscape printout.

Any help would be appreciated.

Thanks a lot,
Ozgur
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Printing userforms

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

'Public Const VK_SNAPSHOT = &H2C

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


Sub Test()
UserForm1.Show
End Sub


In the userform module:




Private Sub CommandButton1_Click()
' keybd_event VK_SNAPSHOT, 0, 0, 0
DoEvents
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 ' key down
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.Range("A1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Close False
End Sub

this places an image of the userform on the worksheet. You can add code to
get it to print that image out as you desire.

--
Regards,
Tom Ogilvy


"Ozgur Pars" wrote:

Hi there,
I searched the board but could not find a post concerning a problem I face.
Its probably simple and silly but still a problem for me...

I have a userform which occupies the whole screen when the workbook is
opened. I try to print it (I can even live with only printing the image on it
-image1- ). I found a way:
userform1.printform

but this only prints part of it and I want a landscape printout.

Any help would be appreciated.

Thanks a lot,
Ozgur

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Printing userforms

Hi Tom,
I probably mislead you.
I have an image on the userform already. I try to print the whole uderform
but only a part is coming out when I use printform.
My problem is basic...print either the whole userform or just the image
which is on it.

Thanks,
Ozgur

"Tom Ogilvy" wrote:

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

'Public Const VK_SNAPSHOT = &H2C

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


Sub Test()
UserForm1.Show
End Sub


In the userform module:




Private Sub CommandButton1_Click()
' keybd_event VK_SNAPSHOT, 0, 0, 0
DoEvents
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 ' key down
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.Range("A1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Close False
End Sub

this places an image of the userform on the worksheet. You can add code to
get it to print that image out as you desire.

--
Regards,
Tom Ogilvy


"Ozgur Pars" wrote:

Hi there,
I searched the board but could not find a post concerning a problem I face.
Its probably simple and silly but still a problem for me...

I have a userform which occupies the whole screen when the workbook is
opened. I try to print it (I can even live with only printing the image on it
-image1- ). I found a way:
userform1.printform

but this only prints part of it and I want a landscape printout.

Any help would be appreciated.

Thanks a lot,
Ozgur

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Printing Userforms leerem Excel Discussion (Misc queries) 3 November 21st 08 04:48 PM
Printing UserForms leerem Excel Discussion (Misc queries) 1 November 20th 08 10:35 PM
Userforms checkboxes and printing Mark Dullingham Excel Programming 1 February 26th 06 01:22 AM
Printing Userforms Greg B[_4_] Excel Programming 3 July 14th 05 11:44 PM
Userforms Ernst Guckel[_4_] Excel Programming 3 March 24th 05 12:13 AM


All times are GMT +1. The time now is 01:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"