Skip to main content

[Migrated content. Thread originally posted on 15 August 2011]

Hi All,

Im trying to call Outlook from with in Visual Cobol using the following code:-

method-id. "button1_Click" final private.
01 ls-call string.
procedure division using by value sender as object e as type "System.EventArgs".
set ls-call to '"C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe" /c ipm.note'
invoke type "System.Diagnostics.Process"::"Start"(ls-call)
end method "button1_Click".

However its returning an error "the system cannot find the file specified"

I can run this from the command prompt and it works ok, any ideas pls.

Kind regards

Neil.

[Migrated content. Thread originally posted on 15 August 2011]

Hi All,

Im trying to call Outlook from with in Visual Cobol using the following code:-

method-id. "button1_Click" final private.
01 ls-call string.
procedure division using by value sender as object e as type "System.EventArgs".
set ls-call to '"C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe" /c ipm.note'
invoke type "System.Diagnostics.Process"::"Start"(ls-call)
end method "button1_Click".

However its returning an error "the system cannot find the file specified"

I can run this from the command prompt and it works ok, any ideas pls.

Kind regards

Neil.
Neil, I suspect the error is caused because you are passing arguments to the executable. According to the documentation (msdn.microsoft.com/.../53ezey2s.aspx) arguments are not supported. You'd have to use a ProcessStartInfo object. E.G.

01 procStartInfo type System.Diagnostics.ProcessStartInfo.
...
set procStartInfo to new System.Diagnostics.ProcessStartInfo
set procStartInfo::Arguments to "/c ipm.note"
set procStartInfo::FileName to "c:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe"
invoke type System.Diagnostics.Process::Start(procStartInfo)

If what you are trying to accomplish is to send an e-mail it's probably better to use the built in .NET classes rather than exec'ing the mailer directory. Have a look at the System.Net.Mail namespace (msdn.microsoft.com/.../system.net.mail.aspx)

[Migrated content. Thread originally posted on 15 August 2011]

Hi All,

Im trying to call Outlook from with in Visual Cobol using the following code:-

method-id. "button1_Click" final private.
01 ls-call string.
procedure division using by value sender as object e as type "System.EventArgs".
set ls-call to '"C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe" /c ipm.note'
invoke type "System.Diagnostics.Process"::"Start"(ls-call)
end method "button1_Click".

However its returning an error "the system cannot find the file specified"

I can run this from the command prompt and it works ok, any ideas pls.

Kind regards

Neil.
Hi Simon,

Thanks for that info it works a treat.

Kind regards

Neil.