Is it possible to pass an argument to Userform_Initialize() in VBA?

Posted on 2007-07-23
Last Modified: 2013-11-25

I'd like to pass an argument to the Userform1_Initialize() event when I call in VBA. Is it possible to do so? I know I could set a public variable and use this variable in my form but I'd like to know if I can do it as an argument passed to the event.

Question by:venmarces
    LVL 76

    Accepted Solution

    To pass a value into a procedure, you need to set the value of one of its parameters in the calling code, but we have no access to the calling side of built-in event procedures. Of course Initialise has no parameters anyway.

    Author Comment

    That's what I thought but I was hoping for a miracle...

    Thanks GrahamSkan!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    A short article about problems I had with the new location API and permissions in Marshmallow
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    760 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

    10 Experts available now in Live!

    Get 1:1 Help Now