+ Reply to Thread
Results 1 to 4 of 4

Declaring variable for object..

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    439

    Declaring variable for object..

    Hi,

    I have a question regarding how to declare variable.
    I have a module with 5 different macro for userform.
    All the 5 macros refer to textbox1, textbox2, so on until textbox10.

    In every macro of that module, i declare the textbox to a variable:
    strTb1 = me.textbox1
    ...
    strTb10 = me.textbox10

    So in every macro, i have to redeclare the variable?

    Is there anyway to declare 1 time those variable linked to textbox without copying and paste in every single macro of that module?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Declaring variable for object..

    Does this help you?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: Declaring variable for object..

    In the code, you have declared the variable in a button click.
    Is there a way to declare that in a separate module?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Declaring variable for object..

    You would have to do everything outside the userform i believe

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by stnkynts; 11-21-2014 at 12:14 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Declaring Object References at Module Level
    By RGrunden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2012, 01:47 AM
  2. Declaring chart object problem
    By Alexander_Golinsky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2012, 01:05 PM
  3. declaring a variable
    By squeekee35 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-06-2011, 03:36 PM
  4. Opening Access without declaring a Global Object?
    By Joel.R.Hill@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2006, 01:00 AM
  5. [SOLVED] Declaring a Rumba session as an Object
    By Matt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-02-2006, 03:10 PM

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