Outlook Warning Setfocus

dazstarr

Registered User.
Local time
Today, 15:18
Joined
Mar 19, 2007
Messages
132
Hi

Can someone help me with this please?

I have a report which I am emailing from a command button. Currently the button opens the report - converts to pdf and then emails (with the outlook warning).

The problem is sometimes the outlook warning doesnt not appear in front of other applications. How can I set the focus of this warning so it comes up on top of other windows?

Many thanks in Advance
Daz
 
I'm trying to do something similar. I'm trying to put a graph in the body of the email. Right now I'm trying to save the report with the graph as a .jpg but can't figure out how to put it in the body of the email - Any ideas?
 
Here is the code I have used to send the report:

/code
Dim stDocName As String
If Me.Dirty Then Me.Dirty = False
stDocName = "rptContactMessage"
DoCmd.OpenReport stDocName, acPreview, , "[CPID]=" & Me!CPID
Call ConvertReportToPDF(stDocName, , "C:\Documents and Settings\All Users\Desktop\ContactMessage.pdf", False, False)
Dim OutlookMessage As Object
Set OutlookMessage = CreateObject("Outlook.application").createitem(0)
OutlookMessage.attachments.Add "C:\Documents and Settings\All Users\Desktop\" & "ContactMessage.pdf"
OutlookMessage.Subject = Format("Contact Message" & Space(2) & Date, "DDDD, MMMM dd yyyy")
OutlookMessage.body = "You have a message." & vbCr & vbCr & "Please check the attached document."
OutlookMessage.to = Me.Staff
OutlookMessage.Send

\code

I am a rookie when it comes to VBA but I think if you replace the path to where your document is - it should work - but it will come as an attachment - I am not sure how to add the graph as the body but if you play around with the OutlookMessage.body line - I am sure you can reference you graph.

Hope this helps.
 
I've been wanting to embed objects into an email for a long time.

I just found out how here...

http://www.mrexcel.com/forum/showthread.php?t=8086

So saving your graph as an image and putting it into an html file and then reading it in like shown on the thread above works for me.

I'm using Outlook 2003.

It's not really embedding the objects like dazstarr describes, (which I would rather do something like, olMessage.body = Reports!rptname.graphname)
but it does give a way to get it done. Not the way Office does it when you copy / paste, but it accomplishes the task. I would still be curious to know how this happens without the workaround I just provided.

Also I have some code at work that I found on a couple different sites that I will post tomorrow that might be able to eliminate the warning window that you are trying to set focus to.. thus eliminating the need to set focus to it.
 
Last edited:
Hi Mutdogus

Many thanks for your reply - thanks for the link - I will play around with it today.

Please let me know if you can find a way to bypass the outlook warning.

Thanks again.
 
Hi

Thanks for posting the link - i will look to implement something soon.

Not sure how you can accomplish what you are after - my knowledge of VBA expertise is very limited - sorry!

Thanks for all your help.
Daz
 

Users who are viewing this thread

Back
Top Bottom