View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] cemorganCO@gmail.com is offline
external usenet poster
 
Posts: 6
Default VB Code - Saving excel workbook as a web page

Hi - I am using the following code to save a workbook, attach it to an
Outlook email and send. I would like to save the workbook as a web
page and attach it. The code works and saves the file as .htm and
attaches it to an email message, but when I open the file from the
message its all coded. Can someone tell me what I'm doing wrong?

Sub EMAIL()
Set WB = ActiveWorkbook
Filename = "Projects.htm"
On Error Resume Next
Kill "H:\" & Filename
On Error GoTo 0
WB.SaveAs Filename:="H:\" & Filename
FileFormat = xlHtm

'Create and show the outlook mail item
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
'Uncomment the line below to hard code a recipient
.To = "
'Uncomment the line below to hard code a subject
.Subject = "Parts Due"
.Attachments.Add WB.FullName
.Display
End With

'Delete the temporary file
WB.ChangeFileAccess Mode:=xlReadOnly
Kill WB.FullName

End Sub