Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimize an email in code

Status
Not open for further replies.

ChopinFan

Technical User
Oct 4, 2004
149
US
I've coded Outlook to automatically create an email, but I also need it to minimize the email on the task bar. There doesn't appear to be any .minimize method for my email object variable. I've found code to minimize the entire Outlook window, but not an email message. How do I do this? Thanks!
 
Don't know what your code looks like, but look at the WindowState property of the Inspector object associated with your MailItem. This can be set to olMaximized, olMinimized (what you are trying to achieve) or olNormalWindow.

Hope this helps.
Mike
 
I did look into that but, unless I missed something, that works to minimize the whole Outlook window, not just the email itself. Here's the block from my code:

rstCountries.MoveFirst
Do Until rstISOCountries.EOF
strFilePath = "C:\Documents and Settings\" & GetUserName() & "\Desktop\" & rstCountries.Fields(0) & " Unusable Images.xls"
'The file system object is used to test if the file exists
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(strFilePath) Then
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
Set objOutlookRecip = objOutlookMsg.Recipients.Add("Name")
objOutlookRecip.Type = olTo
Set objOutlookAttach = objOutlookMsg.Attachments.Add(strFilePath)
With objOutlookMsg
.Subject = rstCountries.Fields(0) & " Unusable Images"
.Body = strEmailText
.Importance = olImportanceHigh
End With
objOutlookMsg.Send
End If
rstISOCountries.MoveNext
rstCountries.MoveNext
Loop

Thanks!
 
Try this:

Code:
Set objOutlookMsg = objOutlook.CreateItem(olMailItem) [COLOR=green]'Your existing line of code[/color]
Set objInspector = objOutlookMsg.GetInspector
objInspector.Display
objInspector.WindowState = olMinimized
[COLOR=green]'The remainder of your code here[/color]

where objInspector is declared as Inspector.

Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top