Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21916

Outlook 2010

$
0
0
Hello All

Lately at the office they be getting more modern software, bit of a disadvantage for me for i use my proggy to start default email and add subject and mailto adress. But now we have OFFICE 2010 and it doesnt work anymore. Starting it as a Shell is OK but i wander if it is possible to start office 2010 (and check if it is open already)
Then open a new email and disconnect from office.

What i found was this, its of great help but i fail to add some stuff a bad programmer if anything



Private Sub Command6HY_Click()

Dim olApp As Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myFolder As Outlook.MAPIFolder
Dim myExplorer As Outlook.Explorer
Dim olNewEmail As Object

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")


If Err.Number <> 0 Then
Set olApp = New Outlook.Application
Set myNameSpace = olApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
'There are no explorer windows so create one
Set myExplorer = Application.Explorers.Add(myFolder)
'Choose the inbox folder
myExplorer.CurrentFolder = myFolder
myExplorer.CurrentView = "Messages"
'Display the sucker
myExplorer.Display
Else
Set myNameSpace = olApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
'Explorer already exists so use the active explorer
Set myExplorer = Application.ActiveExplorer
'Change display to the inbox folder and display
myExplorer.CurrentFolder = myFolder
myExplorer.CurrentView = "Messages"
myExplorer.Display
End If

Set olNewEmail = olLook.CreateItem(0)


olApp.Quit
Set myExplorer = Nothing
Set myFolder = Nothing
Set myNameSpace = Nothing
Set olApp = Nothing
Set olNewEmail = Nothing

end sub

It appears to be starting OUTLOOK but only in the menu bar for a few seconds. If im quick enough it i can select open else the icon dissapears (might be kaspersky doing that). The olnewmail doesnt do anything wherever i place it.
Is there a way to completely start OUTLOOK, go for a new email and add to adress, subject ="subject" and a text "bla bla bla"

We are not allowed to sent data through your own proggy so i need to simply (completely) open OUTLOOK and configure it to the required text and email adres.

Thanks in advance

Viewing all articles
Browse latest Browse all 21916

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>