+ Reply to Thread
Results 1 to 5 of 5

Macro to choose a macro

  1. #1
    Registered User
    Join Date
    02-01-2006
    Posts
    44

    Macro to choose a macro

    Hi,

    This is where I demonstrate my breathtaking ignorance.....

    This is my code;



    Please Login or Register  to view this content.
    Why doesn't it work?

    My only excuse is that it is Friday.......

  2. #2
    Don Guillett
    Guest

    Re: Macro to choose a macro

    try this from ANYWHERE in the workbook. NO need to select.
    Sub Letter1Printchoose()
    If Sheets("Stage 2 Letter").Range("C23").Value <> "" Then
    application.Run ([Sub Letter1Printmulti()])
    else
    application. Run ([Sub Letter1Printsingle()])
    end if
    End Sub



    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Alec H" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > This is where I demonstrate my breathtaking ignorance.....
    >
    > This is my code;
    >
    >
    >
    >
    > Code:
    > --------------------
    >
    >
    > Sub Letter1Printchoose()
    >
    > Sheets("Stage 2 Letter").Select
    > If Range("C23").Value <> "" Then Run ([Sub Letter1Printmulti()])
    > If Range("C23").Value = "" Then Run ([Sub Letter1Printsingle()])
    > Sheets("Customer List").Select
    >
    > End Sub
    >
    >
    > --------------------
    >
    >
    > Why doesn't it work?
    >
    > My only excuse is that it is Friday.......
    >
    >
    > --
    > Alec H
    > ------------------------------------------------------------------------
    > Alec H's Profile:
    > http://www.excelforum.com/member.php...o&userid=31042
    > View this thread: http://www.excelforum.com/showthread...hreadid=518720
    >




  3. #3
    Dave Peterson
    Guest

    Re: Macro to choose a macro

    How about:

    Sub Letter1Printchoose()

    Sheets("Stage 2 Letter").Select
    If Range("C23").Value <> "" Then
    call Letter1Printmulti
    else
    call Letter1Printsingle
    end if
    Sheets("Customer List").Select

    End Sub

    Alec H wrote:
    >
    > Hi,
    >
    > This is where I demonstrate my breathtaking ignorance.....
    >
    > This is my code;
    >
    > Code:
    > --------------------
    >
    >
    > Sub Letter1Printchoose()
    >
    > Sheets("Stage 2 Letter").Select
    > If Range("C23").Value <> "" Then Run ([Sub Letter1Printmulti()])
    > If Range("C23").Value = "" Then Run ([Sub Letter1Printsingle()])
    > Sheets("Customer List").Select
    >
    > End Sub
    >
    >
    > --------------------
    >
    > Why doesn't it work?
    >
    > My only excuse is that it is Friday.......
    >
    > --
    > Alec H
    > ------------------------------------------------------------------------
    > Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
    > View this thread: http://www.excelforum.com/showthread...hreadid=518720


    --

    Dave Peterson

  4. #4
    Registered User
    Join Date
    02-01-2006
    Posts
    44
    Dave,

    Thank you for that, however it doesnt appear to have resolved the issue. It Does now Find the correct Sub, but now "crashes" Word after printing the first copy......

    Simply Print1Letterchoose is intended to be a user activated (via button on worksheet) macro that checks the contents of cell C23 and then either runs Print1Lettermulti or Print1Lettersingle dependant on the result.

    Thanks,

    Alec.
    Last edited by Alec H; 03-03-2006 at 12:02 PM.

  5. #5
    Dave Peterson
    Guest

    Re: Macro to choose a macro

    What sheet contains the C23 that you want to inspect?

    Maybe dropping the selection

    Sub Letter1Printchoose()

    if Sheets("Stage 2 Letter").Range("C23").Value <> "" Then
    call Letter1Printmulti
    else
    call Letter1Printsingle
    end if

    End Sub

    ====
    If that doesn't work...

    What kind of button did you use? I guessed it was a button from the Forms
    toolbar--not a command button from the Control Toolbox toolbar.

    Where did you put this code (including the Letter1printmulti and
    letter1printsingle routines)?

    I'm guessing that you didn't put them in a general module (where they belong).
    I'm guessing that you put them behind one of the worksheets--or behind
    ThisWorkbook????



    Alec H wrote:
    >
    > Dave,
    >
    > Thank you for that, however it doesnt appear to have resolved the
    > issue.
    >
    > Simply Print1Letterchoose is intended to be a user activated (via
    > button on worksheet) macro that checks the contents of cell C23 and
    > then either runs Print1Lettermulti or Print1Lettersingle dependant on
    > the result.
    >
    > Both Print1Lettermulti and Print1Lettersingle work perfectly
    > independantly but I cant seem to get Print1Letterchoose to "see"
    > them......
    >
    > Thanks,
    >
    > Alec.
    >
    > --
    > Alec H
    > ------------------------------------------------------------------------
    > Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
    > View this thread: http://www.excelforum.com/showthread...hreadid=518720


    --

    Dave Peterson

+ 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