Solved

on error

Posted on 2000-02-23
5
139 Views
Last Modified: 2010-05-02
I have this code in my form. It is intended to go through each control and set its font.
Not all controls allow .fontname and use .font.name instead, so the on error lets the code go through each one.

This used to work, but now it doesn't

On Error Resume Next
For Each ctl In form.Controls
  With ctl
    .FontName = myFontName
    .Font.Name = myFontName
    .FontFixed.Name = myFontName
    .FontBold = myFontBold
    .Font.Bold = myFontBold
    .FontItalic = myFontItalic
    .Font.Italic = myFontItalic
  End With
Next

any ideas

I use VB6 SP3
0
Comment
Question by:broadbent
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:tkuppinen
Comment Utility
Why don't you try to use the typeof syntax?


   If TypeOf MyControl Is CommandButton Then    
     do this

ElseIf TypeOf MyControl Is CheckBox Then
     do this

ElseIf TypeOf MyControl Is TextBox Then
     do this
End If
0
 
LVL 1

Expert Comment

by:tkuppinen
Comment Utility
Just add it inside of the loop
0
 
LVL 4

Author Comment

by:broadbent
Comment Utility
Sure, but that requires more work.
The point is that the on error resume did work and should work.
0
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
Comment Utility
Have you changed to 'break on all errors' in design mode.
0
 
LVL 4

Author Comment

by:broadbent
Comment Utility
Y   e   s    
I   think  I may have done so
Yes I have
I don't know when.

Many thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now