Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Macro to change Userform Textbox Font attributes

I have 36 textboxes spread over 1 Userform - Multipage3

I'd like to change the:
1) font size to 12
2) Font Name to Arial
3) Bold
upon running 1 Macro

Is such a macro available? If so .. Where can I get it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to change Userform Textbox Font attributes

Are you doing all the textboxes?

Option Explicit
Private Sub UserForm_Initialize()
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.TextBox Then
With ctrl.Object.Font
.Bold = True
.Name = "Arial"
.Size = 12
End With
End If
Next ctrl
End Sub

If you're not doing them all, you could skip based on name--or cycle through the
ones with nice names (TextBox01 thru TextBox36????).



JMay wrote:

I have 36 textboxes spread over 1 Userform - Multipage3

I'd like to change the:
1) font size to 12
2) Font Name to Arial
3) Bold
upon running 1 Macro

Is such a macro available? If so .. Where can I get it?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Macro to change Userform Textbox Font attributes

Thanks Dave,

This routine is a one-time experience. Seems like it should be placed into
a standard module. To do so would it so something like:

Sub Foo
Dim ctrl as Control
With Userform1
YOUR CODE starting with For Each...
End With


Thanks Jim
"Dave Peterson" wrote:

Are you doing all the textboxes?

Option Explicit
Private Sub UserForm_Initialize()
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.TextBox Then
With ctrl.Object.Font
.Bold = True
.Name = "Arial"
.Size = 12
End With
End If
Next ctrl
End Sub

If you're not doing them all, you could skip based on name--or cycle through the
ones with nice names (TextBox01 thru TextBox36????).



JMay wrote:

I have 36 textboxes spread over 1 Userform - Multipage3

I'd like to change the:
1) font size to 12
2) Font Name to Arial
3) Bold
upon running 1 Macro

Is such a macro available? If so .. Where can I get it?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to change Userform Textbox Font attributes

I would think you'd want the textbox formatted that way each time you show the
userform--but that's just a guess.

JMay wrote:

Thanks Dave,

This routine is a one-time experience. Seems like it should be placed into
a standard module. To do so would it so something like:

Sub Foo
Dim ctrl as Control
With Userform1
YOUR CODE starting with For Each...
End With

Thanks Jim
"Dave Peterson" wrote:

Are you doing all the textboxes?

Option Explicit
Private Sub UserForm_Initialize()
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.TextBox Then
With ctrl.Object.Font
.Bold = True
.Name = "Arial"
.Size = 12
End With
End If
Next ctrl
End Sub

If you're not doing them all, you could skip based on name--or cycle through the
ones with nice names (TextBox01 thru TextBox36????).



JMay wrote:

I have 36 textboxes spread over 1 Userform - Multipage3

I'd like to change the:
1) font size to 12
2) Font Name to Arial
3) Bold
upon running 1 Macro

Is such a macro available? If so .. Where can I get it?


--

Dave Peterson


--

Dave Peterson
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
Textbox font colour change? Tdp Excel Discussion (Misc queries) 6 January 24th 09 05:11 PM
Change colour of font in a textbox? capt Excel Discussion (Misc queries) 2 January 24th 08 04:51 PM
UserForm TextBox Font Size AussieDave Excel Programming 0 September 10th 07 07:18 AM
Userform-Change textbox color and font based on input in other tex Neal Excel Programming 2 July 22nd 05 12:16 AM
How do I change font attributes in a Concatenate statement? DHD58 Excel Worksheet Functions 3 May 29th 05 04:14 PM


All times are GMT +1. The time now is 06:34 AM.

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"