Solved

on error

Posted on 2000-02-23
5
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2550536
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
ID: 2550539
Just add it inside of the loop
0
 
LVL 4

Author Comment

by:broadbent
ID: 2550561
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
ID: 2550588
Have you changed to 'break on all errors' in design mode.
0
 
LVL 4

Author Comment

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

Many thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

696 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