Solved

on error

Posted on 2000-02-23
5
142 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

776 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