Solved

Creating ActiveX control at run-time

Posted on 1998-08-05
6
182 Views
Last Modified: 2010-08-05
I have no experience with VB. I need to create ActiveX control at run-time. I tried to use GetObject and CreateObject passing ProgID. Object is created successfully. But then I cannot call any of its methods or set any of its properties. I even can't show it if I set Visible control window property to true. I get run-time error "Object doesn't support this method".

Below is my piece of code

Dim objChart As Object
Set objChart = GetObject("", "mschartlib.mschart")
objChart.Visible = True
0
Comment
Question by:galkin
[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
6 Comments
 
LVL 1

Expert Comment

by:ndb
ID: 1467937
You should try to make a new object:
Dim objChart As New Object
0
 
LVL 7

Author Comment

by:galkin
ID: 1467938
I tried your solution and I get compiler error "Expected: identifier"
0
 
LVL 2

Expert Comment

by:percosolator
ID: 1467939
got the doesn't support this property or method.

why do you need to create it at run-time?  Why not use early binding?
0
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!

 
LVL 7

Author Comment

by:galkin
ID: 1467940
I try to change control window properties, for instance Visible. In this case I get error that property or method is not supported bu the control. If I call really control method or set proprty I get OLE run-time error.
I do need to create ActiveX control at run-time. I guessed it is very basic simple task, in C++ I would do it in 10 seconds.
0
 

Accepted Solution

by:
chitnis earned 100 total points
ID: 1467941
Activex controls cannot be created at runtime.You have to load at least one controlmyocx(0) on the form at design time,Set its index property to 0 and then create a control array by saying
  load myocx(1)
0
 
LVL 7

Author Comment

by:galkin
ID: 1467942
Could you give me an example. I am absolutely not familiar with VB syntax.
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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

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