



I have created a control using PerlCtrl and safely registered it. It has two properties, which I want to be able to access from a VBA module. It also has a method, which I am able to call and return from. Here is a snippet of VBA code I am using:
Set re = CreateObject("PerlRegex.Match")
count = re.Match("abcdxxabcd", "a..d", "gim")
If count <> 0 Then
Set coll = re.matchedStrings
For Each str In re.matchedStrings
MsgBox str
Next str
End If
It bombs on the "for each ..." command, griping that the object doesn't support that property. Here is a part of the PerlCtrl file used to create the control:
=begin PerlCtrl
[snip]
Methods => {
'Match' => {
RetType => VT_I4,
TotalParams => 3,
NumOptionalParams => 0,
ParamList => [
'string' => VT_BSTR,
'pattern' => VT_BSTR,
'options' => VT_BSTR
]
},
}, # end of 'Methods'
Properties => {
'positions' => {
Type => VT_ARRAY|VT_VARIANT,
ReadOnly => 0,
},
'lengths' => {
Type => VT_ARRAY|VT_VARIANT,
ReadOnly => 0,
},
'matchedStrings' => {
Type => VT_ARRAY|VT_VARIANT,
ReadOnly => 0,
}
}, # end of 'Properties'
[snip]
=end PerlCtrl
What is the correct way to access the properties from within the VBA code? What are the various allowable settings of the "ReadOnly" attribute, and where are those documented?
Thanks for your help!
My best suggestion would be to look at the included examples bundled with PerlCtrl in
C:\Program Files\ActiveState Perl Dev Kit 6.0\Samples\PerlCtrlThese should give you enough hints in how to create the TypeLib hash. Please also check out the reference material in the online docs.
Ok, thanks - I'll give it a whirl. (Which is what my head is now doing.)
Dave Jenkins
How do I make 64-bit app using PDK 7?
zeng
I think you've posted in the wrong thread, Zeng. Sorry.
Dave Jenkins