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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com