Michele , sei un grande !!!
Funziona tutto perfettamente
Inoltre , funziona anche senza scrivere le righe che ti riporto sotto
args(0).Name = "FilterName"
args(0).Value = "MS Excel 97"
non ne conosco il motivo ma funziona.
Ne approfitto delle tue conoscenze per chiederti una precisazione:
Se il file lo volessi aprire in sola lettura , quali altri parametri dovrei
passare ?
Ti ringrazio nuovamente per il tuo aiuto.
Danilo Muggianu
----- Original Message -----
From: "Michele Zarri" <[EMAIL PROTECTED]>
To: <[email protected]>; "Danilo" <[EMAIL PROTECTED]>
Sent: Tuesday, June 06, 2006 2:19 PM
Subject: Re: [dev-it] Aprire un documento excel tramite una macro di calc
On 06/06/06, Danilo <[EMAIL PROTECTED]> wrote:
Ciao a tutti
ho la necessità di aprire, tramite una macro in calc, un foglio excel.
Qualcuno mi sa dire qual'è il codice macro per poterlo fare?
Grazie
Danilo
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003. Le informazioni contenute in
questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da
considerarsi strettamente riservate. Il loro utilizzo è consentito
esclusivamente al destinatario del messaggio, per le finalità indicate nel
messaggio stesso. Qualora riceviate questo messaggio senza esserne il
destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro
sistema. Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.
WARNINGS To the SENSES Of the D.Lgs. the 196/2003. The contained
information in this message of e-mail and/or the file/s enclose to you are
from considering themselves closely classified. Theirs I use is concurred
exclusively with the adressee of the message, for the purposes indicated
in
the same message. In case you receive this message without it are of the
adressee, we kindly pray to give You of news via email and to proceed to
the
destruction of the same message, cancelling it from Your system. To
conserve
the same message, to disclose it also in part, to distribute it to other
subjects, to copy it, or to use it for various purposes, constitutes
contrary behavior to the principles dictates to you from D.Lgs. 196/2003.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Ciao,
Se ho capito bene vuoi aprire un documento XL in calc. Per fare questo devi
definire un filtro per file xls cosi':
Dim args(0) As New com.sun.star.beans.PropertyValue
args(0).Name = "FilterName"
args(0).Value = "MS Excel 97"
Fatto questo basta chiamare la funzione .loadComponentFromURL cosi':
StarDesktop.loadComponentFromURL( sFileToOpenURL, "_blank", 0, args())
Dove sFileToOpenURL e' il nome del file ottenuto ad esempio cosi'
sFileToOpenURL = convertToURL(<percorso in formato Dos
C:\directory\..\name.xls>)
_blank dice a OOo di aprire una nuova finestra
0 (non mi ricordo perche' ho copiato il codice da una mia macro :) )
args(): vedi sopra
NOTA: credo che MS Excel 97 sia giusto, in realta' nella mia macro apro un
documento word e il valore da dare e' MS Word 97)
Fammi sapere se funziona,
Ciao,
Michele
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003. Le informazioni contenute in questo
messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi
strettamente riservate. Il loro utilizzo è consentito esclusivamente al
destinatario del messaggio, per le finalità indicate nel messaggio stesso.
Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla distruzione del
messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio
stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo,
od utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
WARNINGS To the SENSES Of the D.Lgs. the 196/2003. The contained information in
this message of e-mail and/or the file/s enclose to you are from considering
themselves closely classified. Theirs I use is concurred exclusively with the
adressee of the message, for the purposes indicated in the same message. In
case you receive this message without it are of the adressee, we kindly pray to
give You of news via email and to proceed to the destruction of the same
message, cancelling it from Your system. To conserve the same message, to
disclose it also in part, to distribute it to other subjects, to copy it, or to
use it for various purposes, constitutes contrary behavior to the principles
dictates to you from D.Lgs. 196/2003.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]