A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Change fonts throughout database



 
 
Thread Tools Display Modes
  #1  
Old July 15th, 2009, 12:36 PM posted to microsoft.public.access
Rose B
external usenet poster
 
Posts: 93
Default Change fonts throughout database

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.
  #2  
Old July 15th, 2009, 04:21 PM posted to microsoft.public.access
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Change fonts throughout database

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.

  #3  
Old July 15th, 2009, 04:26 PM posted to microsoft.public.access
Rose B
external usenet poster
 
Posts: 93
Default Change fonts throughout database

No, it seems to be more than one. I know that I can go through each form
individually in design mode (which I have started to do) but I thought that
there might be a way that I could loop through some kind of recordset
containing the Access objects and get the job done quicker. (I am finding
Arial with a slighly smaller font size works better)

"Jerry Whittle" wrote:

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.

  #4  
Old July 15th, 2009, 05:44 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Change fonts throughout database

You could write a VBA function to open each form in design mode, step through
the controls and set specific control types to the desired font and font size
and then save the changes.

If you do that I would make a backup BEFORE I tried it, just in case something
does not work the way you want it to.

The following UNTESTED function might give you the basic idea - it has no
error code and has not been tested, so use at your own risk.

Public Function fFixForms()
Dim frmName As String
Dim ctlAny As Control
Dim I As Long
Dim iSave As Long

For I = 0 To CurrentProject.AllForms.Count - 1
iSave = acSaveNo
frmName = CurrentProject.AllForms(I).Name
DoCmd.OpenForm frmName, acDesign
For Each ctlAny In Forms(frmName).Controls
Select Case ctlAny.ControlType
Case acCommandButton
ctlAny.FontName = "Arial"
ctlAny.FontSize = 11
iSave = acSaveYes
Case acLabel
ctlAny.FontName = "Arial"
ctlAny.FontSize = 10
iSave = acSaveYes
End Select
Next ctlAny

DoCmd.Close acForm, frmName, iSave
'Change acSaveYes to acSavePrompt if you want to decide
'whether or not to save on each form

Next I

End Function


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Rose B wrote:
No, it seems to be more than one. I know that I can go through each form
individually in design mode (which I have started to do) but I thought that
there might be a way that I could loop through some kind of recordset
containing the Access objects and get the job done quicker. (I am finding
Arial with a slighly smaller font size works better)

"Jerry Whittle" wrote:

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.

  #5  
Old July 15th, 2009, 05:47 PM posted to microsoft.public.access
fredg
external usenet poster
 
Posts: 4,386
Default Change fonts throughout database

On Wed, 15 Jul 2009 08:26:02 -0700, Rose B wrote:

No, it seems to be more than one. I know that I can go through each form
individually in design mode (which I have started to do) but I thought that
there might be a way that I could loop through some kind of recordset
containing the Access objects and get the job done quicker. (I am finding
Arial with a slighly smaller font size works better)

"Jerry Whittle" wrote:

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.


Does this help?

Public Sub ChangeAllFonts()
Dim Db As DAO.Database, doc As Document, ctl As Control
Set Db = CurrentDb

On Error GoTo Err_Handler
For Each doc In Db.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
For Each ctl In Forms(doc.Name)
On Error Resume Next
ctl.FontName = "Arial"
ctl.fontsize = 10
Next
DoCmd.Close acForm, doc.Name, acSaveYes
On Error GoTo Err_Handler
Next

Exit_ChangeAllFonts:
Set Db = Nothing
Exit Sub
Err_Handler:
MsgBox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_ChangeAllFonts
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #6  
Old July 15th, 2009, 06:07 PM posted to microsoft.public.access
Rose B
external usenet poster
 
Posts: 93
Default Change fonts throughout database

This worked a treat!!!!! THANKS

"fredg" wrote:

On Wed, 15 Jul 2009 08:26:02 -0700, Rose B wrote:

No, it seems to be more than one. I know that I can go through each form
individually in design mode (which I have started to do) but I thought that
there might be a way that I could loop through some kind of recordset
containing the Access objects and get the job done quicker. (I am finding
Arial with a slighly smaller font size works better)

"Jerry Whittle" wrote:

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.


Does this help?

Public Sub ChangeAllFonts()
Dim Db As DAO.Database, doc As Document, ctl As Control
Set Db = CurrentDb

On Error GoTo Err_Handler
For Each doc In Db.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
For Each ctl In Forms(doc.Name)
On Error Resume Next
ctl.FontName = "Arial"
ctl.fontsize = 10
Next
DoCmd.Close acForm, doc.Name, acSaveYes
On Error GoTo Err_Handler
Next

Exit_ChangeAllFonts:
Set Db = Nothing
Exit Sub
Err_Handler:
MsgBox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_ChangeAllFonts
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #7  
Old July 15th, 2009, 06:10 PM posted to microsoft.public.access
Rose B
external usenet poster
 
Posts: 93
Default Change fonts throughout database

This also worked!!! THANKS

(These are good routines, John/Fred, that can be used to change control
attributes, depending upon whichever one is most approporiate).

"John Spencer" wrote:

You could write a VBA function to open each form in design mode, step through
the controls and set specific control types to the desired font and font size
and then save the changes.

If you do that I would make a backup BEFORE I tried it, just in case something
does not work the way you want it to.

The following UNTESTED function might give you the basic idea - it has no
error code and has not been tested, so use at your own risk.

Public Function fFixForms()
Dim frmName As String
Dim ctlAny As Control
Dim I As Long
Dim iSave As Long

For I = 0 To CurrentProject.AllForms.Count - 1
iSave = acSaveNo
frmName = CurrentProject.AllForms(I).Name
DoCmd.OpenForm frmName, acDesign
For Each ctlAny In Forms(frmName).Controls
Select Case ctlAny.ControlType
Case acCommandButton
ctlAny.FontName = "Arial"
ctlAny.FontSize = 11
iSave = acSaveYes
Case acLabel
ctlAny.FontName = "Arial"
ctlAny.FontSize = 10
iSave = acSaveYes
End Select
Next ctlAny

DoCmd.Close acForm, frmName, iSave
'Change acSaveYes to acSavePrompt if you want to decide
'whether or not to save on each form

Next I

End Function


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Rose B wrote:
No, it seems to be more than one. I know that I can go through each form
individually in design mode (which I have started to do) but I thought that
there might be a way that I could loop through some kind of recordset
containing the Access objects and get the job done quicker. (I am finding
Arial with a slighly smaller font size works better)

"Jerry Whittle" wrote:

Is it a problem with all XP machines or just one? You can change font sizes
on a particular machine. Maybe someone changed the default to Large on that
one computer.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Rose B" wrote:

I have created a database in Access 2007 and used a default design for the
forms etc., which uses Font Calibri 11 for most buttons/labels. However, when
run on an XP machine these fonts exceed the size of the label/button size.
What I would like to do is to go through and change all of the font styles
and sizes throughout the database via VB. Can anyone tell me where/how I can
do this? (I am sure all Access objects are available - but just don't know
where!).

(Is there a recommended set of defaults to use so I don't fall into the same
trap again?)

Thanks in advance.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:09 AM.


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