Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default 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
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
Font Issues when using UserForm box after clicking a Checkbox RobGolf72 Excel Discussion (Misc queries) 1 October 9th 07 07:51 PM
Changed default font, previous font still shows when editing Font/Editing Problem Excel Discussion (Misc queries) 0 May 18th 06 04:37 PM
Pb with textboxes font size in a UserForm Jean-Pierre Bidon Excel Programming 1 February 14th 06 05:51 PM
Userform-Change textbox color and font based on input in other tex Neal Excel Programming 2 July 22nd 05 12:16 AM
Dropdown list for font size, font type and number formats ExcelMonkey[_190_] Excel Programming 1 March 9th 05 03:50 PM


All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"