Hello there, hopre you are having a nice day!
Here is my problem: I am in VB6. I create an instance of Excel and a new workbook (or open an existing one). I would like to add a module to the new workbook but it gives me an error message:
"Run-Time error '430' Class does not support Automation or does not support expected interface"
The funny thing is that if I open an existing file which holds a module, I can access the module, read its content and modify it. So I do have a kind of connection to my Excel instance through the Extensibility model, but it seems that the things I can do are limited.
Any one has any idea? For further precision: I have added the references to both the"Excel Object Library" and the"Visual basic for Application Extensibility".
My code looks something like
Here is my problem: I am in VB6. I create an instance of Excel and a new workbook (or open an existing one). I would like to add a module to the new workbook but it gives me an error message:
"Run-Time error '430' Class does not support Automation or does not support expected interface"
The funny thing is that if I open an existing file which holds a module, I can access the module, read its content and modify it. So I do have a kind of connection to my Excel instance through the Extensibility model, but it seems that the things I can do are limited.
Any one has any idea? For further precision: I have added the references to both the"Excel Object Library" and the"Visual basic for Application Extensibility".
My code looks something like
Code:
Sub TestAddModule
Dim xlApp As Excel.Application
Dim wb As Excel.Workbook
Set xlapp = CreateObject("Excel.Application")
Set wb = xlApp.Workbooks.Open("C:\Test.xls")
'I get the error message when executing the next line
wb.VBProject.VBComponents.Add vbext_ct_StdModule
'etc
End Sub
[\CODE]
Any idea most welcome,
NATH