Automation : from Excel to VB ?

  • Thread starter Thread starter PM
  • Start date Start date
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.
 
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
 
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
 
Back
Top