+ Reply to Thread
Results 1 to 3 of 3

Public variables/declarations not passing to UserForm from Application Caller Button

  1. #1
    Registered User
    Join Date
    09-18-2008
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    66

    Public variables/declarations not passing to UserForm from Application Caller Button

    Hi all,

    I have an "Application Caller" Button that declares and sets the variables that I need to use in a UserForm.

    The UserForm Variables are based on a range value, set when a particular Application.Caller button is pressed (Actually a shape on the Worksheet).

    The Sub sets the UserForm button captions perfectly but when the variables are called within the command button routines I get a " Method 'Range' of object _'Global' failed " error

    After the research I have done I am still no further advanced in figuring out the appropriate placement of the Public decalrations in the code.

    Code for the UserForm "Application.Caller" Button (Standard Module) :

    Please Login or Register  to view this content.
    When the UserForm opens, The captions are pre-filled nicely, but when the command button on the form is clicked, the procedure gets the above-mentioned error at the line highlighted in red, and stops:

    Please Login or Register  to view this content.
    Something simple I've missed, for sure, but it baffles me.

    Regards,
    Martin
    Last edited by Lungfish; 01-02-2013 at 06:12 PM. Reason: SOLVED

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Public variables/declarations not passing to UserForm from Application Caller Button

    What is the value of invto when you get the error?

    Also which workbook/worksheet should Range(invto) be referring to?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-18-2008
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    66

    Re: Public variables/declarations not passing to UserForm from Application Caller Button

    Hi again Norie.

    The Answer to your first question cleared the brain blockage that I was having. I even forgot about testing the value to find a solution...

    The Value of invto = Person I should Send the invoice to.... As required.

    This gave me the solution to the code error.

    I am actually being a bit lazy and butchering some old code that I have.

    Solution: Don't be lazy and re-write the code!

    New code working :

    Please Login or Register  to view this content.
    Thanks for your help.

    Best Regards,

    Martin
    Last edited by Lungfish; 01-02-2013 at 06:26 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1