ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dictionary troubles. Declaring and checking .exists (https://www.excelbanter.com/excel-programming/365976-dictionary-troubles-declaring-checking-exists.html)

Abe[_4_]

Dictionary troubles. Declaring and checking .exists
 
I have a dictionary, declared in a module as:
Public dictCornerCellPics

Workbook_Open() contains the Set of the dictionary, as below:
Set dictCornerCellPics = CreateObject("Scripting.Dictionary")


A userform in the project contains a cmdButton_click() line of:
If dictCornerCellPics("a").exists then

This returns a "Run time error: Object Required"

Do all of the uses of dictCornerCellPics have to be in the module that
it is declared in?

What else may be wrong?


Chip Pearson

Dictionary troubles. Declaring and checking .exists
 
Abe

Change
dictCornerCellPics("a").exists
to
dictCornerCellPics.exists("a")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Abe" wrote in message
ps.com...
I have a dictionary, declared in a module as:
Public dictCornerCellPics

Workbook_Open() contains the Set of the dictionary, as below:
Set dictCornerCellPics = CreateObject("Scripting.Dictionary")


A userform in the project contains a cmdButton_click() line of:
If dictCornerCellPics("a").exists then

This returns a "Run time error: Object Required"

Do all of the uses of dictCornerCellPics have to be in the
module that
it is declared in?

What else may be wrong?





All times are GMT +1. The time now is 11:03 PM.

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