Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

print userform (for MVA)

26 views
Skip to first unread message

Mark

unread,
Aug 2, 2004, 4:17:15 AM8/2/04
to
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

unread,
Aug 2, 2004, 8:31:25 AM8/2/04
to
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" <mark...@hotmail.com> wrote in message
news:8df001c47869$1ec60690$a501...@phx.gbl...

Mark

unread,
Aug 3, 2004, 8:04:11 AM8/3/04
to
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

>.
>

Tom Ogilvy

unread,
Aug 3, 2004, 10:49:56 AM8/3/04
to
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" <orla...@geocities.com.br>

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" <mark...@hotmail.com> wrote in message

news:a28401c47951$fcbc7ea0$a401...@phx.gbl...

Mark

unread,
Aug 4, 2004, 3:17:46 AM8/4/04
to
Very well, very well.
Thanks Tom!

Best regards
Mark

>.
>

0 new messages