Printing a User Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a user form using columns A-V in Excel which scrolls down to Row 200.
Each row contains customer details in the colums A to V e.g, Name/Address/
Contact Numbers/ Age etc. As I scroll down the list of custermers their
details appear in the relevant boxes on the User Form. Is it possible when a
customers details fill in the relevant boxes that I can print the User Form
with just their details. I hane placed a Command Button ( Print ) on the User
Form however cannot get it to print. Any help would be much appreciated.
 
Thanks for prompt answer - however I may have phrased the query wrong. I can
get the user form to print when I open it in VBA mode with the statement
UserForm1.PrintForm but when the User Form opens in Excel sheet ( Customers )
and all their details enter the various boxes for that particular customer it
will not print that user form with the customers details. Does that explain
it better???

Regards Mully.
 
Hi Mully,
Thanks for prompt answer - however I may have phrased the query wrong. I can
get the user form to print when I open it in VBA mode with the statement
UserForm1.PrintForm but when the User Form opens in Excel sheet ( Customers )
and all their details enter the various boxes for that particular customer it
will not print that user form with the customers details. Does that explain
it better???

It works fine for me. I just tried by using a simple form with a button and an
editbox with the following code attached to the button:

Private Sub CommandButton1_Click()
Me.PrintForm
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
 
Hi Jan,
Thanks for all your help still struggling inserted following code in to VBA

' This is the click event for UserForm1
Private Sub CommandButton510_Click()
UserForm1.PrintForm
End Sub

all it does is print the user form in VBA mode and not the excel mode with
all members details in the boxes. I inherited the program and being a new
user to excel
find it difficult to write the necessary code to print the form when it
activates in excel - does this explanation help????

Cheers Mully
 
Hi Mully,
find it difficult to write the necessary code to print the form when it
activates in excel - does this explanation help????

What do you mean by "activates in Excel"?

The code I gave you should be tied to a command button that is on the
userform itself. You can access the code of a button (or any other
control) from the VBE by double clicking the control in the userform's
design window.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
 
Hi Jan,

Absolutely brilliant - I just wrote the code not knowing that the command
button was on another sheet with your explanation of clicking twice on the
button in VBA it threw me on to the right sheet and code - just added
UserForm1.PrintForm in the correct place and it worked perfectly. Thank you
again

Regards

Mully
 
Back
Top