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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Excel import / export rely on COM? 1

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,516
Scotland
When you use any of the following commands, does VFP require Excel to be installed on the user's computer:

APPEND FROM ... TYPE XL5
IMPORT FROM ... TYPE XL5
COPY TO ... TYPE XL5
EXPORT TO ... TYPE XL5

I've always assumed that these commands just do a straight file conversion. They don't invoke Excel as a COM server, and they'll work just as well if Excel is not installed.

The reason I ask is that I just tried to do a COPY TO, but the target file was already open in Excel, so I got a lock violation error. Nothing unexpected about that.

Except that the error message was

Code:
OLE Error Code 0x80030021 : A lock violation has occurred

Note the "OLE error code". It's that that made me think that VFP is doing some OLE or COM behind the scenes, in which case it would fail if Excel was not available.

I don't have a machine that doesn't have Excel, so I can't try this for myself.

Can anyone throw any light on this?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike,

It's rather tough to find a machine Excel isn't installed on any more, but I did some test using one of our servers, which is a Windows 2003 server with only the runtimes installed not a development version of VFP. I used a compiled version of a simple 'Dot prompt' interface I wrote.

First, I USEd a table named TEMP.DBF, then did a COPY TO temp.xls TYPE xls just to create a file which I could open with Excel on my development machine. I then opened temp.xls without making any changes to the open spreadsheet.

Using "COPY TO temp.xls TYPE XLS" resulted in the old familiar "File access denied".

However, using "COPY TO temp.xls TYPE XL5" resulted in "OLE Error Code 0x80030020 : A share violation has occurred".
Somewhat different than your OLE error, but an OLE error nevertheless.

I did this with VFP9, so no telling if earlier versions behave the same way, but it seems there must be some internal usage of OLE either in the VFP runtimes or the OS itself for exporting to XL5, but not necessarily for XLS formats.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Seems like one could test on a Virtual Machine. IAC, I'm reasonably sure you don't need Excel installed to use those commands.

Tamar
 
Let me add that the server I ran my testing did not have Excel installed on it.
I thought I mentioned that earlier but after rereading my post, well, I must have neede some more coffee.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Dave,

Thanks for going to so much trouble to answer my question.

Can you clarify one point: Did you actually succeed in doing the COPY TO on the machine that didn't have Excel? That's what I really need to know. The point about the lock violation was just the symptom of the OLE message.

For what it's worth, I saw the same behaviour re the lock message. With XL5 it was an OLE error, but with XLS it was a straight VFP message. But, as I say, that's not really relevant to my question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Tamar,

You're right about using a virtual machine to get the answer.

I did consider that, but it would be mean downloading and installing the VM software, then somehow getting hold of an installable copy of Windows, then installing VFP (or the runtimes) - all of which decided me to post a question here instead.

That said, I will get round to investigating and installing a VM system at some point. I can see lots of uses for it. The biggest problem is installing the OS on top of it, as it's hard to find Windows CDs these days - every computer I've bought since Windows 97 days has Windows pre-installed.

Thanks for your input.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike,

Yes, I was successful with the COPY TO ... TYPE XLS and TYPE XL5 both, on the server not having Excel installed.

The errors I got occurred after opening that same spreadsheet on my development machine which is attached to that server, then repeating those same commands on the server itself.


Hope that clarifies.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
The main reason I keep VPC installed is to make it easy to test client apps in an environment that doesn't have VFP installed. It's cut way down on sending out stuff that's missing a key file or two.

Tamar
 
Mike,

I did consider that, but it would be mean downloading and installing the VM software, then somehow getting hold of an installable copy of Windows, then installing VFP (or the runtimes) - all of which decided me to post a question here instead.

A real piece of cake!
When I read this yesterday I upgraded my developmachine (Win7) with 4Gb of RAM and downloaded virtual PC from MS

I still have my XP-CD's so installed after that.

It works as a charm!! WinXP from within Win7.
Going to extend with Linux as well.

-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top