Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Relative paths and office 2013
Message
From
17/11/2015 04:57:40
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01627367
Message ID:
01627539
Views:
45
Hi Sergey

>You shouldn't use relative path in such cases because you have no idea what default path for application you are controlling through automation is. It used to work because, by coincidence, application default directory used to match VFP default directory. Bottom line, always use full path.

I was actually suspecting some settings or parameters in resource file being that it was virgin machine where VFP was just installed.
Please bear in mind that problem occurs only in my own VFP IDE. Compiled exe running on the same machine executes normally.

The whole thing worked flawlessly (and still does) on all user machines. Only problem is my IDE while in development.
Fullpath indeed solves problem (and can be easily implemented on automation class level) but I am puzzled why is happening
all of a sudden on newly installed VFP on a virgin machine.

As for relative paths... I am not using exactly relative path like
(currentfolder+) .\somefolder\somefile.xls
which depends on current folder, it is always kind of 'beheaded' full path; whole path without drive letter prefix
which naturally is not known prior deployment of app.

So instead of using
c:\rootfolder\subfolder\subfolder\subfolder\file..
it is always
\rootfolder\subfolder\subfolder\subfolder\file..

And it always worked, in all versions of office so far. Except in my new VFP IDE on my new machine with office 2013.
Again on other machine that also has W7 + VFP9 IDE + Office 2013 - no problem.

Only on THIS (new) machine. Will actually try making another virgin installation to see if it happens again or is
just bizarre set of circumstances causing it to happen.

THKS+TIA

Sergio



























>
>>
>>After reinstalling VFP on a new machine with Office 2013, I got into very strange situation where OLE automation will no longer
>>accept relative paths. The same code was working ok past 10 years.
>>
>>It is happening only in development mode (inside VFP ide) when compiled into EXE everything works ok.
>>
>>
>>
>>cFile='\templates\some.xls'
>>if file(cFile)  &&file does exist!
>>  oXl.workbooks.open(cFile)      &&Cannot find file
>>  .
>>  ****BUT
>>  .  
>>  cFile='c:\templates\some.xls'
>>  oXl.workbooks.open(cFile)      &&Opens ok
>>
>>  .
>>
>>
>>
>>The same goes for outlook object attaching file with relative path. As if it applies for all office (or OLE automation with office) .
>>Did not try word or anything else.
>>
>>What am I missing here ?
>>Anybody have any idea why is this happening ?
>>
>>
>>TIA
>>Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform