Multiple command line switches in Outlook 2007

P

paul.bergers

Hello,

Because I'm a newby with Outlook, and my English is not perfect I have
the next question.

I have a VBA-application which is used my many users/customers. In
this application, users can click one button which trigegrs a command
line. This command line creates an e-mail in which the (pdf) invoice
is attached. Additionally, the e-mail adress and subject are filled
in. This works fine with Outlook 2000, 2002 and 2003.

But: do I understand it correctly that with Outlook 2007, it is only
possible to use one switch: either the attachment or the adress?
Is there any way to combine the attachment switch and the adress
switch?

Thank you in advance for your comments and suggestions!

Paul
 
R

Roady [MVP]

Which command line are you using now?

Just curious; if you are using VBA why are you using a command line to
launch and populate a new email?
 
P

paul.bergers

The command line is

"c:\program files\microsoft\office11\outlook.exe -c IPM.note /m" &
StrAdres & "?subject=" & StrSubject & "&Body= " & StrAttachment

where
StrAdres is the destination
StrSubject the subject
StrAttachment the fult path and filename to the attachment

As I wrote before, I'm a newby when it comes to Outlook, so this might
not be the best solution. Do you have any suggestions for improvement?
And: is there a possibility to do this in OL2007?

Thanks,

Paul



Which command line are you using now?

Just curious; if you are using VBA why are you using a command line to
launch and populate a new email?

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more


Because I'm a newby with Outlook, and my English is not perfect I have
the next question.
I have a VBA-application which is used my many users/customers. In
this application, users can click one button which trigegrs a command
line. This command line creates an e-mail in which the (pdf) invoice
is attached. Additionally, the e-mail adress and subject are filled
in. This works fine with Outlook 2000, 2002 and 2003.
But: do I understand it correctly that with Outlook 2007, it is only
possible to use one switch: either the attachment or the adress?
Is there any way to combine the attachment switch and the adress
switch?
Thank you in advance for your comments and suggestions!
 
R

Roady [MVP]

The code below will create an item with the following fields populated
-TO
-CC
-Subject
-Body
-Attachment

After this it will display it to the user but you also comment the .Display
rule and uncomment the .Save and .Send rule to have it send immidately
without user intervention.

I created and tested this code against Outlook 2007 but will work for
previous versions too.

(Offtopic; I guess we could also have done this in Dutch? ;-)

-----BEGIN CODE-----

Sub SendMail()

Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

'On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.Subject = "Your subject goes here"
.Body = "some text in body"
.Attachments.Add ("D:\Documents\test.txt")
.Display
'.Save
'.Send
End With

Set oOutlookApp = Nothing
Set oItem = Nothing

End Sub

-----END CODE-----

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003


-----
The command line is

"c:\program files\microsoft\office11\outlook.exe -c IPM.note /m" &
StrAdres & "?subject=" & StrSubject & "&Body= " & StrAttachment

where
StrAdres is the destination
StrSubject the subject
StrAttachment the fult path and filename to the attachment

As I wrote before, I'm a newby when it comes to Outlook, so this might
not be the best solution. Do you have any suggestions for improvement?
And: is there a possibility to do this in OL2007?

Thanks,

Paul



Which command line are you using now?

Just curious; if you are using VBA why are you using a command line to
launch and populate a new email?

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more


Because I'm a newby with Outlook, and my English is not perfect I have
the next question.
I have a VBA-application which is used my many users/customers. In
this application, users can click one button which trigegrs a command
line. This command line creates an e-mail in which the (pdf) invoice
is attached. Additionally, the e-mail adress and subject are filled
in. This works fine with Outlook 2000, 2002 and 2003.
But: do I understand it correctly that with Outlook 2007, it is only
possible to use one switch: either the attachment or the adress?
Is there any way to combine the attachment switch and the adress
switch?
Thank you in advance for your comments and suggestions!
 
P

paul.bergers

Hi Robert,

Thank you very much for this code (of: dank je wel!)

When I incorporated this in my Access application, I had to do so
minor changes:
- set a reference to Outlook
- use Late binding: e.g. Dim oOutlookApp as Object rather than Dim
oOutlook as Outlook.Application
But then the code works completely as requierd.

So, thank you for learning me something new!

Paul



The code below will create an item with the following fields populated
-TO
-CC
-Subject
-Body
-Attachment

After this it will display it to the user but you also comment the .Display
rule and uncomment the .Save and .Send rule to have it send immidately
without user intervention.

I created and tested this code against Outlook 2007 but will work for
previous versions too.

(Offtopic; I guess we could also have done this in Dutch? ;-)

-----BEGIN CODE-----

Sub SendMail()

Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

'On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.Subject = "Your subject goes here"
.Body = "some text in body"
.Attachments.Add ("D:\Documents\test.txt")
.Display
'.Save
'.Send
End With

Set oOutlookApp = Nothing
Set oItem = Nothing

End Sub

-----END CODE-----

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more


The command line is
"c:\program files\microsoft\office11\outlook.exe -c IPM.note /m" &
StrAdres & "?subject=" & StrSubject & "&Body= " & StrAttachment
where
StrAdres is the destination
StrSubject the subject
StrAttachment the fult path and filename to the attachment
As I wrote before, I'm a newby when it comes to Outlook, so this might
not be the best solution. Do you have any suggestions for improvement?
And: is there a possibility to do this in OL2007?
Which command line are you using now?
Just curious; if you are using VBA why are you using a command line to
launch and populate a new email?
--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more

Hello,
Because I'm a newby with Outlook, and my English is not perfect I have
the next question.
I have a VBA-application which is used my many users/customers. In
this application, users can click one button which trigegrs a command
line. This command line creates an e-mail in which the (pdf) invoice
is attached. Additionally, the e-mail adress and subject are filled
in. This works fine with Outlook 2000, 2002 and 2003.
But: do I understand it correctly that with Outlook 2007, it is only
possible to use one switch: either the attachment or the adress?
Is there any way to combine the attachment switch and the adress
switch?
Thank you in advance for your comments and suggestions!
Paul
 
R

Roady [MVP]

Graag gedaan! ;-)

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003


-----
Hi Robert,

Thank you very much for this code (of: dank je wel!)

When I incorporated this in my Access application, I had to do so
minor changes:
- set a reference to Outlook
- use Late binding: e.g. Dim oOutlookApp as Object rather than Dim
oOutlook as Outlook.Application
But then the code works completely as requierd.

So, thank you for learning me something new!

Paul



The code below will create an item with the following fields populated
-TO
-CC
-Subject
-Body
-Attachment

After this it will display it to the user but you also comment the
.Display
rule and uncomment the .Save and .Send rule to have it send immidately
without user intervention.

I created and tested this code against Outlook 2007 but will work for
previous versions too.

(Offtopic; I guess we could also have done this in Dutch? ;-)

-----BEGIN CODE-----

Sub SendMail()

Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

'On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.Subject = "Your subject goes here"
.Body = "some text in body"
.Attachments.Add ("D:\Documents\test.txt")
.Display
'.Save
'.Send
End With

Set oOutlookApp = Nothing
Set oItem = Nothing

End Sub

-----END CODE-----

--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook 2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more


The command line is
"c:\program files\microsoft\office11\outlook.exe -c IPM.note /m" &
StrAdres & "?subject=" & StrSubject & "&Body= " & StrAttachment
where
StrAdres is the destination
StrSubject the subject
StrAttachment the fult path and filename to the attachment
As I wrote before, I'm a newby when it comes to Outlook, so this might
not be the best solution. Do you have any suggestions for improvement?
And: is there a possibility to do this in OL2007?


On 6 apr, 15:03, "Roady [MVP]"
Which command line are you using now?
Just curious; if you are using VBA why are you using a command line to
launch and populate a new email?
--
Robert Sparnaaij [MVP-Outlook]
Coauthor, Configuring Microsoft Outlook
2003http://www.howto-outlook.com/
Outlook FAQ, HowTo, Downloads, Add-Ins and more
Because I'm a newby with Outlook, and my English is not perfect I
have
the next question.
I have a VBA-application which is used my many users/customers. In
this application, users can click one button which trigegrs a
command
line. This command line creates an e-mail in which the (pdf) invoice
is attached. Additionally, the e-mail adress and subject are filled
in. This works fine with Outlook 2000, 2002 and 2003.
But: do I understand it correctly that with Outlook 2007, it is only
possible to use one switch: either the attachment or the adress?
Is there any way to combine the attachment switch and the adress
switch?
Thank you in advance for your comments and suggestions!
 

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