+ Reply to Thread
Results 1 to 5 of 5

HELP! Run Time Error '1004' for sending email via vba in excel

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    31

    Question HELP! Run Time Error '1004' for sending email via vba in excel

    Hi,

    I am trying to run the code below and I'm getting a run time error on this line. What I'm trying to do with this line is to send a row in the body of the email based on the index value i.
    Please Login or Register  to view this content.
    below is the complete code
    Please Login or Register  to view this content.
    the RangetoHTML function code is below
    Please Login or Register  to view this content.
    Last edited by g1987; 03-15-2012 at 04:24 PM.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: HELP! Run Time Error '1004' for sending email via vba in excel

    What is the value for r or are you referring to column R
    Please Login or Register  to view this content.
    This does not make sense - what are you referring to - column R??? If r is a variable it has not been declared or initialised
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    03-09-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: HELP! Run Time Error '1004' for sending email via vba in excel

    I'm sorry you're right. I mis-typed. However, it still does not work. I am referring to the row index i.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: HELP! Run Time Error '1004' for sending email via vba in excel

    You are still trying to set a range with a value that not even been declared? If you want row index i and columns 1 to 15 then use
    Please Login or Register  to view this content.
    The problem is that you cannot set the range until you have a value for i so either declare the value and initialise it earlier or place the range statement inside the loop.

  5. #5
    Registered User
    Join Date
    03-09-2012
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: HELP! Run Time Error '1004' for sending email via vba in excel

    Oh ok, thanks.

    Can I combine rng2 and rng3 so that they are pasted together as a table?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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