Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 and Excel
Message
De
03/07/2003 12:10:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00806542
Message ID:
00806603
Vues:
13
>Hi
>
>With a lot of help from Cetin Basov I have managed to get VFp to populate an existing Excel spreadsheet. It works fine on one machine running Win2k prof sp5, VFP6 sp5 Office 2000 but not on others with a similar spec. If I run it on a machine which has Excel 97 instad of Excel 2000 it works fine otherwise I get the message
>
>OLS is not an object.
>
>The code is
>
>this._webBrowser41.Navigate2('file://j:\global\mertest.xls')
>oXLS = thisform._webbrowser41.object.document
>oExcel = oXLS.Application
>
>Paths are correct. Dcom permissions are OK
>
>Any bright ideas?
>
>Thanks
>
>Colin

Colin,
Reproduced :) Guess what. I was directly using Shell.Explorer. When I tried it with _WebBrowser4 from FFC (yes I know I suggested:) I got the same error ! document was .null.
I created a test form, dropped a web browser control from 'Activex controls' and a button. Codes are below. It worked but I got the error everytime I tried with FFC webbrowser. I never checked in depth what FFC version does. Probably a property setting or method would do there too.
*WebBrowser.refresh
nodefault

* Test Commandbutton.click
lcXLSFile = Sys(5)+Curdir()+'myTest.xls'
With thisform.OleControl1
     .Navigate2('file://'+lcXLSFile)
     Do While .ReadyState # 4 && Wait for ready state
     EndDo
endwith

oXLS = thisform.OleControl1.object.document
oExcel = oXLS.Application
* Test setting column A,B to red
oExcel.ActiveWorkbook.ActiveSheet.Range('A:B').Interior.ColorIndex = 3 
Cetin
Ç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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform