ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automation Error in Excel VBA (https://www.excelbanter.com/excel-programming/327372-re-automation-error-excel-vba.html)

Fredrik Wahlgren

Automation Error in Excel VBA
 

"VJ" wrote in message
...
Hi,

I am getting the following err If I tried to access the properties of the
form during run time from another workbook.

Method 'Properties' of object '_VBComponent' failed -2147467259

Following is my code Set mynewform =
Workbooks(template_Name).VBProject.VBComponents.It em(module_Name)
With mynewform
For Each FormProperty In .Properties
If FormProperty.Name = "ShowModal" Then
FormProperty.Value = False
End If
Next
End With

But If I run the same code in debug mode, It works fine.

Can somebody suggest me any way around?

Thanks,



Have you set a reference to the VBA Extensibility library?

/Fredrik



Tom Ogilvy

Automation Error in Excel VBA
 
If this is refering to a real template, the name of the workbook you are
refering to won't be the name of the template if it was opened with
File=New and then the template was specified.

--
Regards,
Tom Ogilvy

"VJ" wrote in message
...
Yes, I have referenced to Microsoft Visual Basic for application
extensibility for 5.3.

I am also able to compile it and and it works fine in the debug mode.

"Fredrik Wahlgren" wrote:


"VJ" wrote in message
...
Hi,

I am getting the following err If I tried to access the properties of

the
form during run time from another workbook.

Method 'Properties' of object '_VBComponent' failed -2147467259

Following is my code Set mynewform =
Workbooks(template_Name).VBProject.VBComponents.It em(module_Name)
With mynewform
For Each FormProperty In .Properties
If FormProperty.Name = "ShowModal" Then
FormProperty.Value = False
End If
Next
End With

But If I run the same code in debug mode, It works fine.

Can somebody suggest me any way around?

Thanks,



Have you set a reference to the VBA Extensibility library?

/Fredrik







All times are GMT +1. The time now is 06:15 AM.

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