+ Reply to Thread
Results 1 to 6 of 6

How to combine two VBA codes into one avtion?

Hybrid View

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    7

    How to combine two VBA codes into one avtion?

    Hi there,
    Need helps a lots. I need to combine two vba codes into one action button (Submit). I don’t know any things about this, I need put following:
    Sub Mail_workbook_Outlook_2()
        Dim wb1 As Workbook
        Dim TempFilePath As String
        Dim TempFileName As String
        Dim FileExtStr As String
        Dim OutApp As Object
        Dim OutMail As Object
    
        With Application
            .ScreenUpdating = False
            .EnableEvents = False
        End With
    
        Set wb1 = ActiveWorkbook
    …..
    ……
    ……
    End With
    End Sub

    into
    Private Sub CommandButton2_Click()
    
    End Sub
    Can anyone help me please? Thanks.
    Last edited by arlu1201; 05-08-2013 at 10:27 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: How to combine two VBA codes into one avtion?

    Firstly I recommend you encapsulate your code in hashtags before you get told off ..... Highlight your code and select the hash # on the top menu.

    Private Sub CommandButton2_Click()
         Mail_workbook_Outlook_2
    End Sub
    This will call your email sub from the button on the sheet.
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: How to combine two VBA codes into one avtion?

    Thank you so very much.
    JJ

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

    Re: How to combine two VBA codes into one avtion?

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    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]

  5. #5
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: How to combine two VBA codes into one avtion?

    anytime..........

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

    Re: How to combine two VBA codes into one avtion?

    jjotc,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE] before your code and [/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.

+ 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