Automation : from Excel to VB ?

P

PM

Hello !

I know how to open Excel from VB using Automation.

I do not know how to open VB from Excel.
Is it possible, for instance, to access a Form or a routine of aVB program ?

Thank you for any advice.
And a good day to you all.
Pat.
 
R

R.VENKATARAMAN

perhaps I have not understood you correctly.
But if the vb-toolbar is avalilable in spreadsheet you click <run macro>
icon you get all the macros or subs both in the hidden workbook and also in
"this workbook" you click any macro or sub in the list and click <edit> you
go to that routine.
if this is not what you want apologise
 
S

Stephen Bullen

Hi Pm,
I know how to open Excel from VB using Automation.

I do not know how to open VB from Excel.
Is it possible, for instance, to access a Form or a routine of aVB program ?

Thank you for any advice.
And a good day to you all.

Yes it is. Just put the VB code in an ActiveX dll and instantiate and use it
from VBA:

VB6 project MyProject, class CExposeForm with instancing set to MultiUse:

Public Sub ShowForm()
frmMyForm.Show
End Sub


VBA project with reference set to MyProject:

Sub Test()

Dim oVB6Class As MyProject.CExposeForm

Set oVB6Class = New MyProject.CExposeForm
oVB6Class.ShowForm

End Sub


Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top