Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running Microsoft Excel from VFP
Message
From
29/12/1997 13:59:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
29/12/1997 13:53:55
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00067923
Message ID:
00068288
Views:
30
>>>>>>>In my reporting section, I'm giving a option of transferring reports to excel..
>>>>>>>
>>>>>>>Here, I am simply redirecting the output to a txt file and then starting excel with the txt file name as the command line parameter...
>>>>>>>
>>>>>>>I have questions for the same :-
>>>>>>>
>>>>>>>1. Is there any way I can retrieve the Path of Microsoft Excel, so I can provide it in the run parameter..
>>>>>>>as on every machine it is not sure that its installed in same dir..
>>>>>>>
>>>>>>>2. Is there any better way to do this whole thing...
>>>>>>Check for OLE automationin help and solutions sample and createobject, getobject etc.
>>>>>>Cetin
>>>>>
>>>>>Pls note that I'm Using VFP 3.0b, Can u pls tell me where is the example given for Excel ??
>>>>Sorry Vinod noticed this reply just now. There is an example for 3.0 too. It is in ..\vfphome\samples\ole and named oleaut1.scx
>>>>Here is an example from "Hacker's Guide to VFP 3.0" by Granor and Roche :
>>>>
>>>>Parameters cFileName
>>>>Declare Integer FindWindow in Win32API String lpClassName, String lpWindowName
>>>>If FindWindow("XLMAIN",.NULL.) 0 && Application running
>>>> oXL = getobject(,"Excel.application") && Get a reference to it
>>>> oXL.FileOpen(cFileName)
>>>>else
>>>> oXL = createobject(cFileName,"Excel.Application")
>>>>endif
>>>>
>>>
>>>You should be able to get the directory path for Excel (or any other registered application) by using the GetProfileString API function. I'm not at my desk right now, but will be later in the day. When I get there I'll log back on and post you an example of using this function to retrieve the type information you want.
>>>
>>>I don't know of a reference that specifically addresses the syntax required to use this in VFP. However, both Christine Solomon's book (Microsoft Office Developer's Guide or something very similar to that) and Dan Appleman's book, (Visual Basic Programmer's Guide to the Win32 API) should be very helpful.
>>>
>>>Anyway, I will post you an example a little later today.
>>>
>>>Best wishes,
>>>
>>>Jim Hart
>>Hi Jim,
>>Problem was not getting path to Excel, instead if there is a need for it or not. There isn't a need to know the path, registry knows. So createobject, getobject, addobject etc was all needed.
>>Thanks for addition.
>
>Cetin,
> He is in VFP 3.0b, working with 3.1 clients.. No registry..
>
>Thanx!
>
>tony MIller
>Vancouver,Wa
I confess I say it without trying but when I execute createobject("Word.basic") wouldn't word be activated in Win 3.1 ? Since there is a kind of registry in Win 3.1 also I expect it would. Tomorrow will try on a Win 3.1
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform