Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default print userform and setting margin

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
I've excel 2k.

Any help will be apreciate.

Regards
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default print userform and setting margin

PrintForm doesn't offer any options.

You can snap a picture of the form, then put it on the worksheet and print
it how you wish.

This was posted by
"Orlando Magalhães Filho"

A while back and seems to work:

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

Sub Test()
UserForm1.Show
End Sub


In the userform module:


Private Sub CommandButton1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
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
==============
Adjust it to suit your needs.

--
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
I've excel 2k.

Any help will be apreciate.

Regards
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default print userform and setting margin

Hi Tom!
I had to modified code:
ActiveSheet.PasteSpecial ,,Link:=False,DisplayAsIcon:=False
and Your snapshot work fine, but i want print userform
only.
I've file with only operate on userform. Code:
Me.PrintForm work almost good (print only userform not all
window).
Still lack me setting in enlarge left margin and print
only userform automatically.
Tom, is it possible to make?

Best Regards
Mark with excel2k

-----Original Message-----
PrintForm doesn't offer any options.

You can snap a picture of the form, then put it on the

worksheet and print
it how you wish.

This was posted by
"Orlando Magalhães Filho"

A while back and seems to work:

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

Sub Test()
UserForm1.Show
End Sub


In the userform module:


Private Sub CommandButton1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
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
==============
Adjust it to suit your needs.

--
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
I've excel 2k.

Any help will be apreciate.

Regards
Mark



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default print userform and setting margin

In my experience, the code I posted only pastes a copy of the userform.

If you are getting more in your printout, it means you have not adjusted the
printarea of the worksheet where you pasted the image of the userform to
only print the userform (obviously turn off the grid on that page as well).
In additiona, if you want to adjust the left margin, you would simulate that
by adjusting the printarea of the sheet and the location of the image of the
userform within that printarea.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi Tom!
I had to modified code:
ActiveSheet.PasteSpecial ,,Link:=False,DisplayAsIcon:=False
and Your snapshot work fine, but i want print userform
only.
I've file with only operate on userform. Code:
Me.PrintForm work almost good (print only userform not all
window).
Still lack me setting in enlarge left margin and print
only userform automatically.
Tom, is it possible to make?

Best Regards
Mark with excel2k

-----Original Message-----
PrintForm doesn't offer any options.

You can snap a picture of the form, then put it on the

worksheet and print
it how you wish.

This was posted by
"Orlando Magalhães Filho"

A while back and seems to work:

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

Sub Test()
UserForm1.Show
End Sub


In the userform module:


Private Sub CommandButton1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
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
==============
Adjust it to suit your needs.

--
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
I've excel 2k.

Any help will be apreciate.

Regards
Mark



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default print userform and setting margin

Hi Tom!
I don't know your code (api). I know a bit of VBA.
Actually 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.
Tom, thank you for your reply.
Can you resolve my problem?

I work in excel 2k and WIN 2000.

Best Regards
Mark

-----Original Message-----
In my experience, the code I posted only pastes a copy of

the userform.

If you are getting more in your printout, it means you

have not adjusted the
printarea of the worksheet where you pasted the image of

the userform to
only print the userform (obviously turn off the grid on

that page as well).
In additiona, if you want to adjust the left margin, you

would simulate that
by adjusting the printarea of the sheet and the location

of the image of the
userform within that printarea.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi Tom!
I had to modified code:
ActiveSheet.PasteSpecial ,,Link:=False,DisplayAsIcon:=Fals

e
and Your snapshot work fine, but i want print userform
only.
I've file with only operate on userform. Code:
Me.PrintForm work almost good (print only userform not all
window).
Still lack me setting in enlarge left margin and print
only userform automatically.
Tom, is it possible to make?

Best Regards
Mark with excel2k

-----Original Message-----
PrintForm doesn't offer any options.

You can snap a picture of the form, then put it on the

worksheet and print
it how you wish.

This was posted by
"Orlando Magalhães Filho"

A while back and seems to work:

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

Sub Test()
UserForm1.Show
End Sub


In the userform module:


Private Sub CommandButton1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
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
==============
Adjust it to suit your needs.

--
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
I've excel 2k.

Any help will be apreciate.

Regards
Mark



.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default print userform and setting margin

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 don't know your code (api). I know a bit of VBA.
Actually 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.
Tom, thank you for your reply.
Can you resolve my problem?

I work in excel 2k and WIN 2000.

Best Regards
Mark

-----Original Message-----
In my experience, the code I posted only pastes a copy of

the userform.

If you are getting more in your printout, it means you

have not adjusted the
printarea of the worksheet where you pasted the image of

the userform to
only print the userform (obviously turn off the grid on

that page as well).
In additiona, if you want to adjust the left margin, you

would simulate that
by adjusting the printarea of the sheet and the location

of the image of the
userform within that printarea.

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
Hi Tom!
I had to modified code:
ActiveSheet.PasteSpecial ,,Link:=False,DisplayAsIcon:=Fals

e
and Your snapshot work fine, but i want print userform
only.
I've file with only operate on userform. Code:
Me.PrintForm work almost good (print only userform not all
window).
Still lack me setting in enlarge left margin and print
only userform automatically.
Tom, is it possible to make?

Best Regards
Mark with excel2k

-----Original Message-----
PrintForm doesn't offer any options.

You can snap a picture of the form, then put it on the

worksheet and print
it how you wish.

This was posted by
"Orlando Magalhães Filho"

A while back and seems to work:

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

Sub Test()
UserForm1.Show
End Sub


In the userform module:


Private Sub CommandButton1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
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
==============
Adjust it to suit your needs.

--
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
I've excel 2k.

Any help will be apreciate.

Regards
Mark



.



.



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
Why is the right hand margin so large when I print? idkwia New Users to Excel 1 February 5th 10 08:16 PM
Reset bottom print margin to row 300 from row 66,000. BillBrew New Users to Excel 2 March 15th 07 05:36 PM
print excel truncated on left margin Butterfly Excel Discussion (Misc queries) 1 April 15th 05 02:49 AM
excel margin issues on landscape - also cant print to a full page. Peter MB Excel Discussion (Misc queries) 1 March 10th 05 01:13 PM
Can one have an extra margin gutter, for binding a document print. DaveT Excel Discussion (Misc queries) 1 February 14th 05 03:01 PM


All times are GMT +1. The time now is 01:49 PM.

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"