ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automation : from Excel to VB ? (https://www.excelbanter.com/excel-programming/315006-automation-excel-vbulletin.html)

PM

Automation : from Excel to VB ?
 
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.VENKATARAMAN

Automation : from Excel to VB ?
 
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


PM wrote in message
...
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.






Stephen Bullen[_4_]

Automation : from Excel to VB ?
 
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



PM

Automation : from Excel to VB ?
 
Ah, this is even more precise than your previous answer.
Thanks a million (at least!).

"Stephen Bullen" a écrit dans le message de news:
...
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






All times are GMT +1. The time now is 03:01 AM.

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