Setting default wallpaper in message generated in MS Access 2000

G

Guest

Here is my code I'm using in Access. It works great with the exception of
invoking the template I'm using on my default email box message form. What
I'm trying to do is to use the "wallpaper" set to the inbox new message as
the default wallpaper in the email message I'm generating from Access.

This is the only piece of the puzzel I can't get to work.

Can somebody please help me????

Thanks,

*******************************

Code

********************************

Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim MyBodyText As String
Dim frm As Form
Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String
Dim myattachments As Variant
Dim lItemCount As Long

'send email with spreadsheet

Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "(e-mail address removed)"
MyMail.CC = ""
MyMail.BCC = Text1
MyMail.BodyFormat = olHTML
MyMail.Subject = "Monthly Newsletter"
MyBodyText = "Here is the document"
Set myattachments = MyMail.Attachments
myattachments.Add "C:\JetComp.doc"
MyMail.SentOnBehalfOfName = ""
MyMail.Body = MyBodyText
MyMail.Display

Set MyMail = Nothing
Set myattachments = Nothing
Set MyOutlook = Nothing



Expand AllCollapse All

Manage Your Profile
©2005 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks
|Privacy Statement
 
G

Guest

You must use the HTMLBody property to pass formatted HTML containing inline
images for your background wallpaper.
 
G

Guest

Thanks for the code. I got it to work with the exception of the following:
We have a button that they click cmdSelectFolder to invoke the function to
browse and select a contacts folder which is then set here to
Me![txtFolderName].Value = pfld.Name. When we try and set a default value
for Me![txtFolderName].Value to Sublog_Contacts we get an error because it
seems as though the MAPI profile is not set right.

Can you help us out here? Again, appreciate your help!

***********
Code
*************

Private Sub cmdSelectFolder_Click()

Call SelectFolder

End Sub

Function SelectFolder()

On Error GoTo ErrorHandler

Set appOutlook = CreateObject("Outlook.Application")
Set nms = appOutlook.GetNamespace("MAPI")

SelectContactFolder:
Set pfld = nms.PickFolder

Debug.Print "Default item type: " & pfld.DefaultItemType
If pfld.DefaultItemType <> olContactItem Then
'MsgBox "Please select a Contacts folder"
GoTo SelectContactFolder
End If

Forms![z_RFil5_frmCustom]![frmExportToOutlook].SetFocus
Me![txtFolderName].Value = pfld.Name

Me![LastContact].Value = ""

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit

End Function
 
G

Guest

Your code looks fine to me. Is the user seeing the PickFolder dialog? You
should also handle for if pfld Is Nothing, in case the user clicks cancel on
that dialog.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

Worsty said:
Thanks for the code. I got it to work with the exception of the following:
We have a button that they click cmdSelectFolder to invoke the function to
browse and select a contacts folder which is then set here to
Me![txtFolderName].Value = pfld.Name. When we try and set a default value
for Me![txtFolderName].Value to Sublog_Contacts we get an error because it
seems as though the MAPI profile is not set right.

Can you help us out here? Again, appreciate your help!

***********
Code
*************

Private Sub cmdSelectFolder_Click()

Call SelectFolder

End Sub

Function SelectFolder()

On Error GoTo ErrorHandler

Set appOutlook = CreateObject("Outlook.Application")
Set nms = appOutlook.GetNamespace("MAPI")

SelectContactFolder:
Set pfld = nms.PickFolder

Debug.Print "Default item type: " & pfld.DefaultItemType
If pfld.DefaultItemType <> olContactItem Then
'MsgBox "Please select a Contacts folder"
GoTo SelectContactFolder
End If

Forms![z_RFil5_frmCustom]![frmExportToOutlook].SetFocus
Me![txtFolderName].Value = pfld.Name

Me![LastContact].Value = ""

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit

End Function


Eric Legault said:
You must use the HTMLBody property to pass formatted HTML containing inline
images for your background wallpaper.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top