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!

Outlook Automation: Open an .OFT (template) 2

Status
Not open for further replies.

Docpro777

Programmer
Jul 1, 2003
105
US
The (generic) code (from Fox Advisor). If any of you have experience with Outlook COM objects:

oOutlook = Createobject("outlook.application")
oNameSpace = oOutlook.getnamespace("MAPI")
oDefaultFolder=oNameSpace.GetDefaultFolder(10) &&CONTACTS
oMsg = oOutlook.CreateItemFromTemplate( "C:\ MyApp\ Forms\ Mytemplate.OFT")
oInspector = oMsg.GetInspector
oInspector.Activate()

Is this Error message avoidable?:
"OLE IDispatch exception code: Can't open the file:
C:\ MyApp \Forms \Patient.Oft. It may not exist, you may not have permission to open it, or it may be open in another program ... check permissions for the folder..."

Thanks in advance.

Philip M. Traynor, DPM
 
HI

Do you have all the files related in
c:\MyApp\Forms\ directory..

It appears you are having spaces in your
C:\MyAPp\Forms\.... and within quotes. Maybe VFP is looking for the file in a non existing directory and so fails.

(This is my observation but I have not used what you have said here).
:)

ramani :)
(Subramanian.G)
 
DocPro777

It is either a pathing issue (space in the path) or you have another instance of Outlook running that didn't release properly from a previous instanciation, and has locked the file.

But I assume the problem is not releated to the fact that in your code you have:
("C:\MyApp\Forms\Mytemplate.OFT")
and the error is
C:\MyApp\Forms\Patient.Oft. ?? Reporting a different form?

Just so you know, the codes you are using works on my
system. You may also look at faq184-1772, wich show you how to automate a OFT template without having to show it.





Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top