ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How could VBA connect with another customized application programm (https://www.excelbanter.com/excel-discussion-misc-queries/162519-how-could-vba-connect-another-customized-application-programm.html)

Ella

How could VBA connect with another customized application programm
 
The situation is that.

Right now I have the VBA code as below:

Dim test
Sub macro1()
On Error Resume Next
Dim x As Variant
If test < Empty And test < Null Then
x = test.end()
Set test = Nothing
End If
On Error GoTo 0
Set test = CreateObject("Place.interface")
End Sub

And there is also a customized appllication programm is with
title"Place". And this one a user interface that you could see the
detail progress of the data processing.

But where I could find the definition of the object "Place", and also
class "interface". And also the class of "test".

I am confused.


Chip Pearson

How could VBA connect with another customized application programm
 
I am assuming that your other application is an ActiveX EXE or ActiveX DLL.
Open the workbook in which you want to use the application. In the VBA
Editor, go to the Tools menu and choose References. In that list, scroll
down to "Place" (which I assume is the name of the component library -- it
is the Project Name you used in VB if you created the component in VB). If
you don't find that item in the list, close Excel, go to the Windows Start
menu, choose Run and enter the following and press OK:

RegSvr32 "C:\Some\Path\Here\Place.dll"

or whatever the complete file name of the Place component happens to be.
That will register the components with Windows. Then open Excel, go to VBA,
then the Tools menu and then References. Find "Place" in the list and check
it.

Now, you need to declare a variable of the type of the creatable object in
the Place component (there may be more than one creatable object). Use a
Public variable, declared before and outside of any other procedu

Public MyPlace As Place.Interface

Then in some procedure (likely a startup or initialization procedure), set
MyPlace to an instance of the Place.Interface object:

Sub Initialize()
Set MyPlace = New Place.Interface
' more code as needed
End Sub

To view the various objects, properties, and methods of the Place component,
open the Object Browser (F2) in VBA. In the Drop Down box that likely
displays "<All Libraries", change it to "Place" or whatever the component
name. It will show you the objects and their properties and methods, but not
any real help information. For that, you need to contact the developer of
the control.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


Now, you have a globally accessible variable, MyPlace, that you can use from
any other procedure in any module.
"Ella" wrote in message
oups.com...
The situation is that.

Right now I have the VBA code as below:

Dim test
Sub macro1()
On Error Resume Next
Dim x As Variant
If test < Empty And test < Null Then
x = test.end()
Set test = Nothing
End If
On Error GoTo 0
Set test = CreateObject("Place.interface")
End Sub

And there is also a customized appllication programm is with
title"Place". And this one a user interface that you could see the
detail progress of the data processing.

But where I could find the definition of the object "Place", and also
class "interface". And also the class of "test".

I am confused.




All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com