PC Review


Reply
Thread Tools Rate Thread

ByRef argument type mismatch when passing dictionary object

 
 
signon77
Guest
Posts: n/a
 
      8th Jan 2008
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" ?
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      8th Jan 2008
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)



"signon77" <(E-Mail Removed)> wrote in message
news:b105ebf3-9dec-4356-a1cf-(E-Mail Removed)...
> 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" ?



 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      8th Jan 2008
ByRef is the default, you need ByVal

Sub RightClick_BlotterMenu(ByVal MenuOptionsDictionary As
Dictionary)


"signon77" wrote:

> 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" ?
>

 
Reply With Quote
 
signon77
Guest
Posts: n/a
 
      8th Jan 2008
On Jan 8, 1:45*pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> 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)
>
> "signon77" <signo...@yahoo.com> wrote in message
>
> news:b105ebf3-9dec-4356-a1cf-(E-Mail Removed)...
>
>
>
> > 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" ?- Hide quoted text -

>
> - Show quoted text -



Hi Bob

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

Rob


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      8th Jan 2008
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)



"signon77" <(E-Mail Removed)> wrote in message
news:096f9138-46c7-47db-84c6-(E-Mail Removed)...
On Jan 8, 1:45 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> 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)
>
> "signon77" <signo...@yahoo.com> wrote in message
>
> news:b105ebf3-9dec-4356-a1cf-(E-Mail Removed)...
>
>
>
> > 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" ?-
> > Hide quoted text -

>
> - Show quoted text -



Hi Bob

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

Rob



 
Reply With Quote
 
signon77
Guest
Posts: n/a
 
      8th Jan 2008
On 8 Jan, 14:07, "Bob Phillips" <bob....@somewhere.com> wrote:
> 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)
>
> "signon77" <signo...@yahoo.com> wrote in message
>
> news:096f9138-46c7-47db-84c6-(E-Mail Removed)...
> On Jan 8, 1:45 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
>
>
>
>
>
> > 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)

>
> > "signon77" <signo...@yahoo.com> wrote in message

>
> >news:b105ebf3-9dec-4356-a1cf-(E-Mail Removed)...

>
> > > 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" ?-
> > > Hide quoted text -

>
> > - Show quoted text -

>
> 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
 
Reply With Quote
 
signon77
Guest
Posts: n/a
 
      8th Jan 2008
On 8 Jan, 14:07, "Bob Phillips" <bob....@somewhere.com> wrote:
> 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)
>
> "signon77" <signo...@yahoo.com> wrote in message
>
> news:096f9138-46c7-47db-84c6-(E-Mail Removed)...
> On Jan 8, 1:45 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
>
>
>
>
>
> > 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)

>
> > "signon77" <signo...@yahoo.com> wrote in message

>
> >news:b105ebf3-9dec-4356-a1cf-(E-Mail Removed)...

>
> > > 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" ?-
> > > Hide quoted text -

>
> > - Show quoted text -

>
> 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
 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      8th Jan 2008
signon77 wrote:
>
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ByRef Argument Type Mismatch Sprinks Microsoft Excel Programming 5 8th Aug 2008 04:11 PM
ByRef Argument Type mismatch Tone Microsoft Excel Programming 4 3rd Jul 2008 02:35 PM
Byref Argument Type Mismatch =?Utf-8?B?QWxleA==?= Microsoft Access VBA Modules 2 25th Oct 2006 09:31 PM
ByRef argument type mismatch Scott Microsoft Access Form Coding 1 15th Jun 2006 07:55 PM
ByRef argument type mismatch Sunny Microsoft Access Getting Started 2 27th Feb 2004 10:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 PM.