Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel 97 non-support continues...
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00205190
Message ID:
00205300
Views:
16
>Here's what I'm trying in a PRG, the direct CreateObject that's supposed to work generates a server error on my machine (I posted on that problem last week, but no one seems to have heard of it). Anyway, with a small table open:
>
>
>release oExcel
>_VFP.DataToClip(,,3)
>oTemp = GetObject('','excel.sheet')
>oExcel = oTemp.Application
>oExcel.Workbooks.Add()
>oRange = oExcel.Range("A1",Chr(65+FCount()-1)+Alltrim(Str(RecCount())))
>oRange.PasteSpecial()
>oExcel.Visible = .T.
>
>
>It appears to work (no errors), but Excel only briefly flashes at the Visible line, then closes. Can you see anything that might be causing trouble in my code?

I don't know specifically what problem you are having, but I gather that Excel doesn't always register itself properly, so that commands like GetObject() don't always work as documented. I once automated Excel from Access, and found that, contrary to Access' documentation, Excel had to already be open before I could use GetObject (which also exists in Access). I suppose that one just has to fiddle with different combinations of GetObject or CreatObject, creating an Excel application object or opening the desired file, until something works.

My sysadmin, who is not a programmer, confirmed that Excel is known to have registration problems. In my case, the .XLS extension never got associated with Excel in Explorer.

By the way, Access can open Excel spreadsheets as a "linked table" without conversion or automation, which figures because they are both in Office. Access can also link and open a FoxPro free table. I would say that Access is ahead of the game in this one respect. In the interest of avoiding another tedious "Fox is dead" thread, feel free to ignore this paragraph.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform