vba user form
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA User Form

VBA User Form

resolvedResolved · Low Priority · Version 2003

replyReply Tue 26 Oct 2010, 22:32Delegate Kamil said...

Kamil has attended:
Excel VBA Intro Intermediate course

VBA User Form

Hello,

I have got a question regarding ending user form. I was trying to build simple form to set print area but I can't remove form after formatting is performed. I was trying to use "Unload" function, but in this case doesn't work (below my code)

Private Sub CommandButton1_Click()

Call TextBox1_Change
Call HorizontalLayout_Click
Call VerticalLayout_Click
Unload CommandButton1_Click - this line doesn't work

End Sub

Private Sub HorizontalLayout_Click()
If HorizontalLayout = True Then
ActiveSheet.PageSetup.Orientation = xlLandscape
Else
ActiveSheet.PageSetup.Orientation = xlPortrait
End If
End Sub

Sub VerticalLayout_Click()
If VerticalLayout = True Then
ActiveSheet.PageSetup.Orientation = xlPortrait
Else
ActiveSheet.PageSetup.Orientation = xlLandscape
End If
End Sub

Private Sub TextBox1_Change()
Dim x As Integer
x = TextBox1.Value
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = x
End With
End Sub

For upcoming training course dates see: Pricing & availability

replyReply Fri 29 Oct 2010, 14:18Trainer Jacob said...

RE: VBA User Form

Hi Kamil

Thanks for your post and the code as well. We may be able to solve this for you but will need to have your working files to run the code in.

If you can email to jacob we will review and should a quick fix reveal itself we will let you know.

Also if the requirement takes more time to figure out and we need to allocate a trainer to work on it we will advise of this and any related costs for you to decide.

Kind regards

Jacob

Fri 5 Nov 2010: Automatically marked as resolved.

 

Please browse our web site to find out more about
excel consultant and other Microsoft training courses.

Excel tip:

Display Functions on Worksheets

Functions in Excel can be difficult to recall their format/syntax

For example, you want to use the =PMT function.

Enter =PMT, then select keystroke, CTRL+SHIFT+A.

This usful memory jog, will display the arguments of a function on a worksheet, allowing the user to proceed with the generation of the function



View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard