ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   print userform (for MVA) (https://www.excelbanter.com/excel-programming/305709-print-userform-mva.html)

Mark[_17_]

print userform (for MVA)
 
Hi,
I'd like print userform and setting (enlarge) leftmargin.
Actually my printout is shift max to left and top.
Is there any solution in VBA (in module or class)?
i have code in body userform now:
Me.PrintForm
but printForm doesn't offer any options.
I find out snap a picture of the userform but how snap the
userform (only) without remain window???

I work in windows and excel 2000.

Any help will be apreciate.

Kind Regards
Mark


Tom Ogilvy

print userform (for MVA)
 
the code I provided does just take a picture of the userform alone. If you
then pasted it on a worksheet, you will need to manage where you put it,
what the worksheet looks like, and how you define the print area to achieve
your result. Printform alone offers no options.

But I have already told you this in you previous post.

--
Regards,
Tom Ogilvy



"Mark" wrote in message
...
Hi,
I'd like print userform and setting (enlarge) leftmargin.
Actually my printout is shift max to left and top.
Is there any solution in VBA (in module or class)?
i have code in body userform now:
Me.PrintForm
but printForm doesn't offer any options.
I find out snap a picture of the userform but how snap the
userform (only) without remain window???

I work in windows and excel 2000.

Any help will be apreciate.

Kind Regards
Mark




Mark[_17_]

print userform (for MVA)
 
Hi Tom!
I know your reply, but I always answer you.
I enjoy you deal with my problem!
I don't know your code (api). I know a bit of VBA.
Actually thanks to You i have pasted whole window
(application and userform), and i'd like only userform. It
isn't dependent on printarea - image paste in worksheet by
your code is snapshot all display in my monitor.
If in snapshot is display all monitor (not olny userform)
how i set printarea autoamticly?
Still i can't snapshot only userform.

Can you resolve my problem or give me any tips?

I work in excel 2k and WIN 2000.

Best Regards
Mark

-----Original Message-----
the code I provided does just take a picture of the

userform alone. If you
then pasted it on a worksheet, you will need to manage

where you put it,
what the worksheet looks like, and how you define the

print area to achieve
your result. Printform alone offers no options.

But I have already told you this in you previous post.

--
Regards,
Tom Ogilvy



"Mark" wrote in message
...
Hi,
I'd like print userform and setting (enlarge)

leftmargin.
Actually my printout is shift max to left and top.
Is there any solution in VBA (in module or class)?
i have code in body userform now:
Me.PrintForm
but printForm doesn't offer any options.
I find out snap a picture of the userform but how snap

the
userform (only) without remain window???

I work in windows and excel 2000.

Any help will be apreciate.

Kind Regards
Mark



.


Tom Ogilvy

print userform (for MVA)
 
You are correct and I was wrong. Here is a version that will capture just
the userform:

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 = 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
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

"Mark" wrote in message
...
Hi Tom!
I know your reply, but I always answer you.
I enjoy you deal with my problem!
I don't know your code (api). I know a bit of VBA.
Actually thanks to You i have pasted whole window
(application and userform), and i'd like only userform. It
isn't dependent on printarea - image paste in worksheet by
your code is snapshot all display in my monitor.
If in snapshot is display all monitor (not olny userform)
how i set printarea autoamticly?
Still i can't snapshot only userform.

Can you resolve my problem or give me any tips?

I work in excel 2k and WIN 2000.

Best Regards
Mark

-----Original Message-----
the code I provided does just take a picture of the

userform alone. If you
then pasted it on a worksheet, you will need to manage

where you put it,
what the worksheet looks like, and how you define the

print area to achieve
your result. Printform alone offers no options.

But I have already told you this in you previous post.

--
Regards,
Tom Ogilvy



"Mark" wrote in message
...
Hi,
I'd like print userform and setting (enlarge)

leftmargin.
Actually my printout is shift max to left and top.
Is there any solution in VBA (in module or class)?
i have code in body userform now:
Me.PrintForm
but printForm doesn't offer any options.
I find out snap a picture of the userform but how snap

the
userform (only) without remain window???

I work in windows and excel 2000.

Any help will be apreciate.

Kind Regards
Mark



.




Mark[_17_]

print userform (for MVA)
 
Very well, very well.
Thanks Tom!

Best regards
Mark


-----Original Message-----
You are correct and I was wrong. Here is a version that

will capture just
the userform:

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 = 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
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

"Mark" wrote in message
...
Hi Tom!
I know your reply, but I always answer you.
I enjoy you deal with my problem!
I don't know your code (api). I know a bit of VBA.
Actually thanks to You i have pasted whole window
(application and userform), and i'd like only userform.

It
isn't dependent on printarea - image paste in worksheet

by
your code is snapshot all display in my monitor.
If in snapshot is display all monitor (not olny

userform)
how i set printarea autoamticly?
Still i can't snapshot only userform.

Can you resolve my problem or give me any tips?

I work in excel 2k and WIN 2000.

Best Regards
Mark

-----Original Message-----
the code I provided does just take a picture of the

userform alone. If you
then pasted it on a worksheet, you will need to manage

where you put it,
what the worksheet looks like, and how you define the

print area to achieve
your result. Printform alone offers no options.

But I have already told you this in you previous post.

--
Regards,
Tom Ogilvy



"Mark" wrote in message
...
Hi,
I'd like print userform and setting (enlarge)

leftmargin.
Actually my printout is shift max to left and top.
Is there any solution in VBA (in module or class)?
i have code in body userform now:
Me.PrintForm
but printForm doesn't offer any options.
I find out snap a picture of the userform but how

snap
the
userform (only) without remain window???

I work in windows and excel 2000.

Any help will be apreciate.

Kind Regards
Mark



.



.



All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com