[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

on error

Posted on 2000-02-23
5
Medium Priority
?
148 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 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

656 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