+ Reply to Thread
Results 1 to 4 of 4

Mail Single sheet as HTML(HTM) file

  1. #1
    Registered User
    Join Date
    06-15-2005
    Posts
    2

    Mail Single sheet as HTML(HTM) file

    Hello everyone!
    I have a working macro, which sends a single sheet from the workbook to the following mail receipients. E-mail addresses are specified in the sheet with customer list.
    I need an upgrade.
    I want to send not an .xls file, but a .htm file.

    What changes should I do? How to make excel export single sheet and save it as htm file, then e-mail it?

    P.S. How to remove an Outlook Express warning "Would you like to send the message?" I have to press SEND every time I e-mail something.

    Great thanks to all who are able to help.

    Macro code is:

    Sub Mail_ActiveSheet()
    For a = Cells(4, 3).Value To Cells(4, 4).Value (
    Rows(a).Select
    Selection.Copy
    Rows("1:1").Select
    Application.ActiveSheet.Paste
    If Cells(1, 15).Value <> "" Then
    Sheets("kl sar orig").Select
    d = Cells(1, 15).Value
    Sheets("sheet_to_mail").Select
    b = Cells(15, 5).Value
    c = Cells(15, 6).Value
    Dim wb As Workbook
    Dim strdate As String
    strdate = Format(Now, "dd-mm-yy h-mm-ss")
    Application.ScreenUpdating = False
    ActiveSheet.Copy
    Set wb = ActiveWorkbook
    With wb
    .SaveAs "Vartotojui " & ThisWorkbook.Name _
    & " " & strdate & a & ".xls"
    Cells.Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    .Sendmail d, _
    & b & " iki " & c
    .ChangeFileAccess xlReadOnly
    Kill .FullName
    .Close True
    End With
    Else
    End If
    Sheets("kl sar orig").Select
    Application.ScreenUpdating = True
    Next a
    End Sub

  2. #2
    Ron de Bruin
    Guest

    Re: Mail Single sheet as HTML(HTM) file

    You can't do this with SendMail

    If you use Outlook then you can attach a htm file to the mail
    Do you use that ?

    If you want a example post back


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "argi" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hello everyone!
    > I have a working macro, which sends a single sheet from the workbook to
    > the following mail receipients. E-mail addresses are specified in the
    > sheet with customer list.
    > I need an upgrade.
    > I want to send not an .xls file, but a .htm file.
    >
    > What changes should I do? How to make excel export single sheet and
    > save it as htm file, then e-mail it?
    >
    > P.S. How to remove an Outlook Express warning "Would you like to send
    > the message?" I have to press SEND every time I e-mail something.
    >
    > Great thanks to all who are able to help.
    >
    > Macro code is:
    >
    > Sub Mail_ActiveSheet()
    > For a = Cells(4, 3).Value To Cells(4, 4).Value (
    > Rows(a).Select
    > Selection.Copy
    > Rows("1:1").Select
    > Application.ActiveSheet.Paste
    > If Cells(1, 15).Value <> "" Then
    > Sheets("kl sar orig").Select
    > d = Cells(1, 15).Value
    > Sheets("sheet_to_mail").Select
    > b = Cells(15, 5).Value
    > c = Cells(15, 6).Value
    > Dim wb As Workbook
    > Dim strdate As String
    > strdate = Format(Now, "dd-mm-yy h-mm-ss")
    > Application.ScreenUpdating = False
    > ActiveSheet.Copy
    > Set wb = ActiveWorkbook
    > With wb
    > SaveAs "Vartotojui " & ThisWorkbook.Name _
    > & " " & strdate & a & ".xls"
    > Cells.Select
    > Application.CutCopyMode = False
    > Selection.Copy
    > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
    > SkipBlanks _
    > :=False, Transpose:=False
    >
    > Sendmail d, _
    > & b & " iki " & c
    > ChangeFileAccess xlReadOnly
    > Kill .FullName
    > Close True
    > End With
    > Else
    > End If
    > Sheets("kl sar orig").Select
    > Application.ScreenUpdating = True
    > Next a
    > End Sub
    >
    >
    > --
    > argi
    > ------------------------------------------------------------------------
    > argi's Profile: http://www.excelforum.com/member.php...o&userid=24329
    > View this thread: http://www.excelforum.com/showthread...hreadid=379309
    >




  3. #3
    Registered User
    Join Date
    06-15-2005
    Posts
    2
    Please give an example.

  4. #4
    Ron de Bruin
    Guest

    Re: Mail Single sheet as HTML(HTM) file

    Try this example

    Sub Mail_ActiveSheet_Outlook()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim wb As Workbook
    Dim strdate As String

    strdate = Format(Now, "dd-mm-yy h-mm-ss")
    Application.ScreenUpdating = False
    ActiveSheet.Copy
    Set wb = ActiveWorkbook

    With wb
    .SaveAs "Part of " & ThisWorkbook.Name _
    & " " & strdate, FileFormat:=xlHtml
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .To = "[email protected]"
    .CC = ""
    .BCC = ""
    .Subject = "This is the Subject line"
    .Body = "Hi there"
    .Attachments.Add wb.FullName
    'You can add other files also like this
    '.Attachments.Add ("C:\test.txt")
    .display 'or use .Display
    End With
    .ChangeFileAccess xlReadOnly
    Kill .FullName
    .Close False
    End With
    Application.ScreenUpdating = True
    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "argi" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Please give an example.
    >
    >
    > --
    > argi
    > ------------------------------------------------------------------------
    > argi's Profile: http://www.excelforum.com/member.php...o&userid=24329
    > View this thread: http://www.excelforum.com/showthread...hreadid=379309
    >




+ 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