+ Reply to Thread
Results 1 to 8 of 8

Compressing multi used variables

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Compressing multi used variables

    How are you guys.

    What i would like to know is, In the code im using to make a phone call from a userform the varibles are set in each and every sub. It all works well though could they be compressed into only being used once like an option variable or somethink like that.
    i know that more that one variable can be decleared at the same time of the same type "dim x, Y, z as long.

    Please Login or Register  to view this content.
    Last edited by D_Rennie; 07-05-2009 at 09:56 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Compressing multi used variables

    I call these subs from the userform that why i made 3 copys like that.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Compressing multi used variables

    Really, you only want one DialNumber routine, and then when you call it, you pass the number you want to ring as an argument. Your three routines are unnecessary as they are almost identical.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Compressing multi used variables

    Yes i had thet as a brain wave as i was typing it.
    There realy is only about 3 changes between them.
    I would like to keep it in its own module and im not sure if?how i can pass through the info for the double clicks of the textboxes. ( the only reason i want to keep it in its own module its getting aroung 1500 lines of code and i would get confused without some seperation"
    There are 3 text boxes that have own numbers each with a double click. so if there where to share the same sub im thinking that i would need to store the number as a variable and use it for the tapirewuestmakecall. or what ive played with before using other userform items Textboxes captions list ect That seam sloppy though.

    Cheers ill take a good look at how i can do it,

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Compressing multi used variables

    Your dialling routine would be like this:
    Please Login or Register  to view this content.
    and you would call it from each control using:
    Please Login or Register  to view this content.
    for example.

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Compressing multi used variables

    Thankyou.
    I will have a look after the weekend,

  7. #7
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Compressing multi used variables

    I havent tryed anythink yet "not enough time todoy"
    Though what i got from it is when calling a sub, A variable can be set to be used through the module. So DialPhone Combobox_List_Search.TextBox10.
    Would that still be call DialPhone Combobox_List_Search.TextBox10?
    then Sub DialPhone(strDial As String) textbox10 is like the transphered variable set as strdial.
    If thats correct it makes sence though leaves alot of questions of what would refer to what using more than one variable.

    Thankyou.

  8. #8
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Compressing multi used variables

    romperstomper thanks for the help ive had a play around and understand passing the variables farily well. It works well with the dialing & left the msgbox in the module and passing variables to that fine.
    Cheers.

    The thing i dont get is why it dosent need the Call like i had before.
    Last edited by D_Rennie; 07-05-2009 at 09:55 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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