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

I don't understand
The code behind the command button is
Priser.PrintForm

but the print dosn't print the name on the
userform only what inside the form
I have try whit activewindow.printout
but here i get a error

Alvin


"Terrance Rebello" skrev:

Perhaps it is an issue with the Print_Area.
Also it might help showing the code behind this command button

- Terrance Rebello

"Alvin Hansen" wrote:

Hi!!
I have this in a commandbuttom in a userform

Priser.PrintForm

Its working its printing but but but
it dont print the titel of the userform??
CAn't i do this??

Best regards

Alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Print problem

Here is a way to do it using the Windows API:

Modification of code originally posted by
"Orlando Magalhães Filho"

Modified to capture just the userform (not the whole window).

In a General Module:

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

--
Regards,
Tom Ogilvy

"Alvin Hansen" wrote in message
...
I don't understand
The code behind the command button is
Priser.PrintForm

but the print dosn't print the name on the
userform only what inside the form
I have try whit activewindow.printout
but here i get a error

Alvin


"Terrance Rebello" skrev:

Perhaps it is an issue with the Print_Area.
Also it might help showing the code behind this command button

- Terrance Rebello

"Alvin Hansen" wrote:

Hi!!
I have this in a commandbuttom in a userform

Priser.PrintForm

Its working its printing but but but
it dont print the titel of the userform??
CAn't i do this??

Best regards

Alvin



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
Print to Fit Problem JD Excel Discussion (Misc queries) 0 May 22nd 08 05:04 PM
problem to print zilah New Users to Excel 3 April 23rd 07 10:12 AM
Print Problem Loretta Excel Discussion (Misc queries) 4 January 10th 07 11:35 PM
Print problem.. proshail Excel Discussion (Misc queries) 2 July 4th 05 10:27 PM
Print problem Tom Ogilvy Excel Programming 1 September 22nd 04 05:37 AM


All times are GMT +1. The time now is 09:55 PM.

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

About Us

"It's about Microsoft Excel"