Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
Hello,
I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
Bill, if you put this in the userform's module, it will change all the
fonts when the form is displayed. However, it doesn't "stick", so when you view the form in design mode, it'll look as it did originally. Maybe someone else has an idea on making it stick. James Private Sub UserForm_Initialize() Dim e As Integer For e = 0 To Me.Controls.Count - 1 With Me.Controls(e).Font .Bold = True .Name = "Times New Roman" .Size = 12 End With Next e End Sub Bill wrote: Hello, I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
Sub Changefont()
Dim fnt As Font Dim ctrl As Object Dim frm As Object Set frm = ThisWorkbook.VBProject.VBComponents("Userform1") For Each ctrl In frm.Designer.Controls On Error Resume Next ctrl.Font.Name = "Arial" On Error GoTo 0 Next End Sub -- Regards, Tom Ogilvy "Bill" wrote: Hello, I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
Tom, Is this standard VBA, put in a standard module? I get error
"Programmatic access to form not trusted" or something like that. Never seen that one before! If I reset and run again, I get error "Method VB Object of _Workbook failed". James Tom Ogilvy wrote: Sub Changefont() Dim fnt As Font Dim ctrl As Object Dim frm As Object Set frm = ThisWorkbook.VBProject.VBComponents("Userform1") For Each ctrl In frm.Designer.Controls On Error Resume Next ctrl.Font.Name = "Arial" On Error GoTo 0 Next End Sub -- Regards, Tom Ogilvy "Bill" wrote: Hello, I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
go to tools/macro/secuity, click trusted publishers and select trust
access to visual basic projects. Zone wrote: Tom, Is this standard VBA, put in a standard module? I get error "Programmatic access to form not trusted" or something like that. Never seen that one before! If I reset and run again, I get error "Method VB Object of _Workbook failed". James Tom Ogilvy wrote: Sub Changefont() Dim fnt As Font Dim ctrl As Object Dim frm As Object Set frm = ThisWorkbook.VBProject.VBComponents("Userform1") For Each ctrl In frm.Designer.Controls On Error Resume Next ctrl.Font.Name = "Arial" On Error GoTo 0 Next End Sub -- Regards, Tom Ogilvy "Bill" wrote: Hello, I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Font in Userform
OK, thanks.
witek wrote: go to tools/macro/secuity, click trusted publishers and select trust access to visual basic projects. Zone wrote: Tom, Is this standard VBA, put in a standard module? I get error "Programmatic access to form not trusted" or something like that. Never seen that one before! If I reset and run again, I get error "Method VB Object of _Workbook failed". James Tom Ogilvy wrote: Sub Changefont() Dim fnt As Font Dim ctrl As Object Dim frm As Object Set frm = ThisWorkbook.VBProject.VBComponents("Userform1") For Each ctrl In frm.Designer.Controls On Error Resume Next ctrl.Font.Name = "Arial" On Error GoTo 0 Next End Sub -- Regards, Tom Ogilvy "Bill" wrote: Hello, I would like to change the font in mutliple userforms that contain a variety of items such as frames, textboxes, etc. Decided I don't like the way the userforms look and would like to try other fonts. Is there code that can be written to change the font in userforms? Doesn't seem possible to me. Thanks, Bill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Font Issues when using UserForm box after clicking a Checkbox | Excel Discussion (Misc queries) | |||
Changed default font, previous font still shows when editing | Excel Discussion (Misc queries) | |||
Pb with textboxes font size in a UserForm | Excel Programming | |||
Userform-Change textbox color and font based on input in other tex | Excel Programming | |||
Dropdown list for font size, font type and number formats | Excel Programming |