Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2008, 03:59 AM
Authorized User
 
Join Date: Mar 2008
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default DropDown problem in Excel 2003

I have used a code from "Excel 2007 VBA Programmer's Reference" book to create a DropDown on a worksheet (Chapter 10 "Adding controls").
It's OK in Excel 2007, but when I open it in Excel 2003, the error occur when code reach the following line of code:

With Sheet2.DropDowns(Application.Caller)

VBA says that it can't get property DropDowns of Worksheet class (Run-time error 1004). What should be corrected to avoid this error?
 
Old March 25th, 2008, 08:13 AM
Authorized User
 
Join Date: Mar 2008
Posts: 35
Thanks: 0
Thanked 1 Time in 1 Post
Default

I would guess it's the Sheet qualifier that causes the problem.
If the Sheet's name is Sheet2 maybe you should use
Code:
Sheets("Sheet2").Dropdowns(Application.Caller)
or, if the Sheet has been assigned to a Sheet variable e.g. Products then you should use
Code:
Products.DropDowns(Application.Caller)
 
Old March 27th, 2008, 02:21 AM
Authorized User
 
Join Date: Mar 2008
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default

I changed the sheet qualifier as "Sheets" and as "Worksheets" but resultless. Is there any other way to fix this problem?

 
Old March 27th, 2008, 05:20 AM
Authorized User
 
Join Date: Mar 2008
Posts: 35
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sektor, hoping that I'm not over-analytical, let me mention this:
In order for the
With Sheet2.DropDowns(Application.Caller)
to work, a valid SheetName must have been assigned to the "Sheet2" qualifier.
i.e. the following lines must come beforehand (in Excel 2003 VBA):
Code:
Dim Sheet2 as Worksheet
Set Sheet2 = Worksheets("Sektor") 'if Sektor is the name of the Sheet with the dropdown
With Sheet2.DropDowns(Application.Caller)
' etc.....
I guess you must have something similar in XL 2007 VBA (if not exactly the same).

If this is not the case and Sheet2 is the name of the Sheet, then I would insist that my previous mail should work just fine (use Sheets("Sheet2")).
Try this: Change the name of your Sheet to "Sektor" and try using Sheets("Sector").











Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown problem in excel 2007 Aker Excel VBA 1 October 31st, 2008 11:49 AM
Modify Hyperlinks in Excel 2003 nemesis538 Excel VBA 2 August 3rd, 2007 03:02 AM
C# and excel on 2003 server mrlou88 C# 2005 3 May 23rd, 2007 11:30 PM
Excel 2003 VBA Function RollingWoodFarm Excel VBA 15 August 2nd, 2006 04:24 PM
Excel 2003 alfmeiggs BOOK: Excel 2003 VBA Programmer's Reference 1 May 18th, 2005 09:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.