ByRef argument type mismatch when passing dictionary object

S

signon77

Hello all,

In one function I am doing the following:

Dim dictMenuOptions As Dictionary
Set dictMenuOptions = New Dictionary
dictMenuOptions.Add "EDIT", "BtnEdit_Click"
dictMenuOptions.Add "COPY", "BtnCopy_Click"
dictMenuOptions.Add "DELETE", "BtnDelete_Click"
dictMenuOptions.Add "PKG EDIT",
"BtnPackageEditor_Click"
dictMenuOptions.Add "OFFICIAL",
"BtnOfficial_Click"

Call RightClick_BlotterMenu(dictMenuOptions)

The first line of "RightClick_BlotterMenu" is defined as :

Sub RightClick_BlotterMenu(MenuOptionsDictionary As
Dictionary)

Does anyone know why I am getting a "ByRef argument type mismatch" ?
 
B

Bob Phillips

Works fine for me.

I presume you have set a reference, and this is all in a standard code
module?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

Joel

ByRef is the default, you need ByVal

Sub RightClick_BlotterMenu(ByVal MenuOptionsDictionary As
Dictionary)
 
S

signon77

Works fine for me.

I presume you have set a reference, and this is all in a standard code
module?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)












- Show quoted text -


Hi Bob

When you say "set a reference" what does that mean?

Rob
 
B

Bob Phillips

In the VBIDE, Tools>References, and scroll down to Microsoft Scripting
Runtime, and check that box.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



Works fine for me.

I presume you have set a reference, and this is all in a standard code
module?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)












- Show quoted text -


Hi Bob

When you say "set a reference" what does that mean?

Rob
 
S

signon77

In the VBIDE, Tools>References, and scroll down to Microsoft Scripting
Runtime, and check that box.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)






Hi Bob

When  you say "set a reference" what does that mean?

Rob- Hide quoted text -

- Show quoted text -

Hi Bob,

Microsoft Scripting Runtime was already referred to by the
application.

On the face of it this code should work. I've even rebooted my machine
but still have precisely the same error.

Strangely it even occurs when I change the object from a dictionary
object to a collection.

Rob
 
S

signon77

In the VBIDE, Tools>References, and scroll down to Microsoft Scripting
Runtime, and check that box.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)






Hi Bob

When  you say "set a reference" what does that mean?

Rob- Hide quoted text -

- Show quoted text -

Hi Bob,

I've found the source of the issue. I was looking in the wrong area
entirely.

Thanks for your help.

Rob
 
A

Alan Beban

signon77 said:
I've found the source of the issue. I was looking in the wrong area
entirely.

Thanks for your help.

Rob

Care to enlighten the rest of us as to the source of the issue?

Thanks,
Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top