+ Reply to Thread
Results 1 to 4 of 4

VBA macro replacement using a VBA procedure.

  1. #1
    Registered User
    Join Date
    09-12-2014
    Location
    AUCKLAND NZ
    MS-Off Ver
    365
    Posts
    0

    VBA macro replacement using a VBA procedure.

    I like Excel VBA for its macro recording function and it's programmable. I have been using it for a decade.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166
    Hello JOHNWRICHARDSNZ,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    09-12-2014
    Location
    AUCKLAND NZ
    MS-Off Ver
    365
    Posts
    0

    Re: VBA macro replacement using a VBA procedure.

    During development I would like to run a VBA procedure able to generate and put macro code text into an existing module so it's ready to run when needed. But not into the same module as the generator obviously.

    Thus I need a VBA procedure that can copy text of new VBA code from a generated worksheet into an existing VBA procedure so that it will run when the program is executed.

    I have a VBA procedure that generates new VBA code text into a worksheet. The new VBA code is to replace old similar code in an existing VBA procedure

    (preferably within a subroutine or function or as one). The new code could replace the contents of a whole VBA module if necessary, (delete and paste).

    The new code concerned is from VBA interpreting a Decision Table worksheet into a SELECT CASE statement on a worksheet.

    Sample new code:

    SelectCase: ' as made by running Example1 for the decision table with GENERATED CODE on for VBA
    Windows(FileName).Activate

    ' start of code generated by the decision table processor
    Select Case True
    '' Case 1
    Case ((Trim(WageMore) > "") = False) And (Trim(RentMore) > "") And (Trim(Paid_More) > "") _
    And (RentDueDate <= Paid_Date)
    GoSub ProcessRentLine: GoSub BalanceRowOut

    '' Case 2
    Case ((Trim(WageMore) > "") = False) And (Trim(RentMore) > "") And (Trim(Paid_More) > "") _
    And ((RentDueDate <= Paid_Date) = False)
    GoSub ProcessPaidLine: GoSub BalanceRowOut

    '' Case 3
    Case ((Trim(WageMore) > "") = False) And (Trim(RentMore) > "") And ((Trim(Paid_More) > "") = False)
    GoSub ProcessRentLine: GoSub BalanceRowOut
    ' . . .
    '' Case 14
    Case ((Trim(WageMore) > "") = False) And ((Trim(RentMore) > "") = False) And ((Trim(Paid_More) > "") = False)
    '' Do loop handles it

    Case Else
    Stop ' unexpected result
    End Select
    ' end of code generated by the decision table processor

    Return

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA macro replacement using a VBA procedure.

    You will need to post your question in the main forum. This is for introductions only.

+ 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. Replies: 0
    Last Post: 10-02-2012, 03:06 PM
  2. excel replacement macro question
    By Tian in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2009, 12:45 PM
  3. [SOLVED] automatic replacement macro (follow up)
    By markx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2006, 06:20 AM
  4. Macro and timer replacement
    By petez in forum Excel General
    Replies: 0
    Last Post: 01-22-2005, 01:45 AM

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