In vb 6.0 how a declaration to a custom object is error

Posted on 2006-03-23
Last Modified: 2010-04-07
Dim objCurrency as New Currency

Error: Compile error
Expected Identifier

Any suggestions?
Question by:swansonplace
    LVL 33

    Expert Comment

    This is because Currency itself is a reserved datatype for currency values.
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    this could be due to the library (dll) providing the Currency class not being properly added in the project references
    please check the project references; and if you can browse (F2) the class library
    LVL 33

    Expert Comment

    You can change the class name to another one.
    LVL 8

    Accepted Solution

    Try using late binding

    Dim objCurrency as Object

    Set objCurrency = CreateObject("Currency")

    If this doesn't work then make sure the dll is registered using regsvr32 "path to the DLL file"

    Also check your registery if the dll is registered

    Start reg edit ("Start->Run-> type regedit) and navigate to HKEY_CLASSES_ROOT\

    Check in that list that your DLL component is registered and that the name of the component is the same as you expect.

    Hope that helps,


    Author Comment

    Thank you all very much for your assistance!
    LVL 8

    Expert Comment

    by:Leo Eikelman
    thank you  :)


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now