Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Code - Saving excel workbook as a web page
The code below will correct you save problem.
Sub EMAIL() Set WB = ActiveWorkbook FName = "Projects.htm" On Error Resume Next Kill "H:" & FName On Error GoTo 0 ActiveWorkbook.SaveAs _ Filename:="C:\temp\" & FName, _ FileFormat:=xlHtml " wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
vb code for saving a workbook when shutting an excel file down | Excel Programming | |||
saving worksheet without code page | Excel Programming | |||
Saving as web page for workbook with frozen panes | Excel Discussion (Misc queries) | |||
Saving workbook with frozen panes as web page htm | Excel Programming | |||
Saving a Workbook without code | Excel Programming |