Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:29:22+00:00 2026-06-16T19:29:22+00:00

I have a VB 6 Add-in that adds all the projects to a project

  • 0

I have a VB 6 Add-in that adds all the projects to a project group, iterates through each of the component of those projects, and if a form or usercontrol is found then changes its properties.

The properties are defined by the user. If user wants to change the height of all the forms or usercontrol then the code snippet is as follows

Private Sub Update_ButtonClick()
  '..declaring all the variables here

  ' VBInstance is initialized to VBIDE.VBE when the add-in is loaded

  For Index = 1 To projCount
    compoCount = VBInstance.VBProjects(Index).VBComponents.Count
    For jIndex = 1 To compoCount

      csFileName = VBInstance.VBProjects(Index).VBComponents(jIndex).name
      componentType = VBInstance.VBProjects(Index).VBComponents(jIndex).Type

      If componentType = VBIDE.vbext_ct_VBForm Or componentType = VBIDE.vbext_ct_UserControl Then '.frm or .ctl         
        VBInstance.VBProjects(Index).VBComponents(jIndex).Properties(propChange).Value = propvalue 'changing the property
        VBInstance.VBProjects(Index).VBComponents(jIndex).SaveAs csFileName 'Saving the file
      End If
    Next jIndex
  Next Index
End Sub

Whenever I give the Properties name as Font, I get the error

Runtime error ‘425’ Invalid Object use

I have tried PropertyBag.WriteProperty from http://visualbasic.freetutes.com/learn-vb6-advanced/lesson13/p20.html but it does not serve my purpose.

Is there any way out to set the Font property of a control or form?

When I open the ctl or form in notepad, I cannot find the Font property in it so I cannot use text replacement here.

Can anyone help?

Updated Code :


Private Sub Update_ButtonClick()
    Dim fobject As New StdFont
    fobject.Name = "Arial"
    Set propvalue = fobject
    For Index = 1 To projCount
     compoCount = VBInstance.VBProjects(Index).VBComponents.Count
     For jIndex = 1 To compoCount
      csFileName = VBInstance.VBProjects(Index).VBComponents(jIndex).Name
      componentType = VBInstance.VBProjects(Index).VBComponents(jIndex).Type
      If componentType = 5 Or componentType = 8 Then 
       VBInstance.VBProjects(Index).VBComponents(jIndex).Properties("Font").Value=  propvalue
      VBInstance.VBProjects(Index).VBComponents(jIndex).SaveAs csFileName 
      End If
       Next jIndex
     Next Index 
End Sub

And the error that i got is

Run-time error '425':
Invalid object use
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:29:24+00:00Added an answer on June 16, 2026 at 7:29 pm

    The Font property is an object, not an simple intrinsic value. You’ll need to use Set with an appropriate StdFont object assigned to propvalue.

    Alternatively, you can special case the font and just set the property’s .Name property to the required font name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to add a textbox inside a form that is composed of a
I have a small Visual studio add-in that walks down active project and insert
I have a Django project that has two models: Group and Person. Groups can
I have a float that adds numbers and its not displaying all the decimal
I have two validation groups: parent and child I have an add button that
I have a page called /add that you can add a Dog on and
I have used custom listview and custom rating bar. If I add that custom
I have a tuple, like ('key1', 'value1') that I want to add that to
I have an add this button on the website that is rendering a border
I have a crystal report that I have to add a Bar Code to.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.