![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Finally I figured out a solution; I'll share this.
I took the word document and manually copy/paste into the body of the E-mail. I than did a view source, copy and paste into a regular editor (I use Visual Slick Edit). I than saved it as a text file. I used the same open as it it was a Word document and did the content.text command to get it into the body of the message. THanks for all the help, Steve "Ken Slovak - [MVP - Outlook]" wrote in message ... Is the HTML in the Word doc correctly formatted? Look at it and an HTML message and try to see where the HTML is not the same. I'd suspect that you aren't getting a valid Account object, I've used SendUsingAccount with valid Account objects with no problems, although reading that object property only works right in a Send event. Try getting an Account object using one of your formulations and see if you do get a valid Account object or if it's Nothing. I'd also make sure to resolve all recipients as a matter of good practice: myMailItem.Recipients.ResolveAll -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Stephen Plotnick" wrote in message ... WordFileName = "C:\temp\Steve.HTM" Dim WordContent As String Dim AppWord As New Microsoft.Office.Interop.Word.ApplicationClass With AppWord .Visible = False .ScreenUpdating = False .DisplayAlerts = WdAlertLevel.wdAlertsNone End With Dim WordDoc As Microsoft.Office.Interop.Word.Document WordDoc = AppWord.Documents.Open(CType(WordFileName, Object)) WordDoc.Content.Select() WordDoc.Content.Copy() Dim objClipboard As IDataObject = Clipboard.GetDataObject() If objClipboard.GetDataPresent(DataFormats.Html) Then WordContent = objClipboard.GetData(DataFormats.Html) Else WordContent = "XXX" End If WordDoc.Close() WordDoc = Nothing AppWord.Quit() Filename = "C:\temp\IL Broker List.xls" If Not File.Exists(Filename) Then Console.WriteLine("E-mail name and address file does not exist") ;", "Problem with STEVE.xls" , "Please ensure spreadsheet of E-mail address is in the C:\TEMP directory", WordFileName) Else Console.WriteLine("Sending documents") obook = GetObject("C:\TEMP\STEVE.xls") Dim irow As Integer Dim SendPersonName As String For irow = 2 To 25000 If obook.Worksheets(1).Cells(irow, 1).value "" Then 'MsgBox(obook.Worksheets(1).Cells(irow, icol).Value) SendPersonName = obook.Worksheets(1).cells(irow, 2).value & " " & obook.Worksheets(1).cells(irow, 3).value Console.WriteLine(SendPersonName) automail(obook.Worksheets(1).Cells(irow, 1).value, "Looking To Buy Investment Propert ", WordContent, WordFileName) Else irow = 25000 End If Next End If Close_rtn() End Sub Public Sub automail(ByVal mail_to As String, ByVal subject As String, ByVal msg As String, ByVal filename As String) Dim myOutlook As New Outlook.Application() Dim myMailItem, attach As Object myMailItem = myOutlook.CreateItem(Outlook.OlItemType.olMailItem ) myMailItem.HTMLbody = msg If File.Exists(filename) Then attach = myMailItem.Attachments 'DO NOT Send the attachement 'attach.Add(filename) End If If Trim(mail_to) "" Then myMailItem.To = Trim(mail_to) End If myMailItem.SendUsingAccount = myOutlook.Application.Session.Accounts("WellInvest ments") 'myMailItem.SendUsingAccount = "WellInvestments" subject = subject myMailItem.Subject = subject myMailItem.Send() myMailItem = Nothing myOutlook = Nothing End Sub Problem 1: In the SendUsingAccount (not commented) I get the error below. In the SendUsingAccount (commented out) the program processes but it sends out from ny default E-mail. Problem 2: I have a Word Docement that I want to get the information into the body of the E-mail. There is simple formatting, like bold and undeline. I've tried "DOC", "DOCX", "RTF", "HTM". I cannot get the text to look correct. It is either non formatted text or ends up having all kinds of HTML code. Thanks in advance for assistance, Steve System.Reflection.TargetParameterCountException was unhandled Message="Number of parameters specified does not match the expected number." Source="Microsoft.VisualBasic" StackTrace: at Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) at Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) at DaveWellsEMAIL.Module1.automail(String mail_to, String subject, String msg, String filename) in C:\Users\Stephen Plotnick\Documents\Visual Studio 2005\Projects\DaveWellsEMAIL\DaveWellsEMAIL\Module 1.vb:line 95 at DaveWellsEMAIL.Module1.Main() in C:\Users\Stephen Plotnick\Documents\Visual Studio 2005\Projects\DaveWellsEMAIL\DaveWellsEMAIL\Module 1.vb:line 69 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context( Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2007: Problems with HTML e-mail formatting | [email protected] | Outlook - General Queries | 0 | May 4th 07 11:25 AM |
Outlook 2007 Add-in using VSTO 2005 SE | Kenn | Outlook - Using Forms | 1 | November 4th 06 03:27 AM |
Problems Sending Mail Via Dialup | WarpGammon Director | Outlook - General Queries | 2 | October 10th 06 09:06 PM |
Problems sending mail via sub folder in Outlook 2003 | wn | Outlook - Installation | 1 | August 16th 06 04:46 PM |
Sending keys from vb.2005 to Outlook | Al Christoph | Outlook - Using Forms | 1 | May 1st 06 05:18 PM |