From: Song on 5 Apr 2010 11:28 Access 2007 and reference Microsoft Outlook 12.0 object library First time run, it's OK. On the 2nd time run, it gives "runtime error 462. The remote server machine does not exist or is unavailable." http://support.microsoft.com/kb/319832 talks about unqualified reference but I don't know how to fix my code. Also, I need 2 line gap between 'dear' line and table below it but don't know how to do it. Thank you for helping. Song Private Sub cmdEmail_Click() Dim olApp As Outlook.Application Dim objMail As Outlook.MailItem Dim ctlBody As String Set olApp = Outlook.Application Set objMail = olApp.CreateItem(olMailItem) ctlBody = "Dear " & StrConv(Forms!Contacts.EmailTo, vbProperCase) & "," ctlBody = ctlBody & "<table border='1' width='90%' bgcolor='#ECECEC'><tr><td width='119'>" & _ "Asset ID</td><td>" & _ Me.AID & "</td></tr><tr>" & _ "Item</td><td>" & _ UCase(Me.Item) & "</td></tr><tr>" & _ "Checkout on</td><td>" & _ Me.CheckOut & "</td></tr></table>" With objMail .To = StrConv(Forms!Contacts.First & " " & Forms!Contacts.Last, vbProperCase) & _ "<" & IIf(IsNull(Forms!Contacts![E-mailUpdate]), Forms!Contacts! EmailAddress, Forms!Contacts![E-mailUpdate]) & ">" .BodyFormat = olFormatHTML .HTMLBody = "<HTML><BODY>" & ctlBody & "</p></BODY></HTML>" .Display End With Set objMail = Nothing Set olApp = Nothing End Sub
|
Pages: 1 Prev: Outlook 2007 Access 2007 Next: Allen Browne's Audit Trail Not Working |