Help us help you.
Posting the entire script is helpful. You tell us the line number, but
force us to count to line 36 while hoping we notice every line that might be
line-wrapped, thus changing the count. Why not tell us the text of the line
in which the error occurred?
In any case, you are using the Office DSOFile.OleDocumentProperties object's
Open method with no arguments. I can't find the object model for this
object, but I assume you have looked at it. When opened this way does the
object allow both read and write access to the file?
-Paul Randall
Thanks also for letting me know that I should have included info (besides
the lne no) identifying the offending line. I'll do that in the future. It
seems so obvious in retrospect.
Oh well. Live & learn.
Marc
Do you have good links about the dso object model?
Thank you.
Giovanni.
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
objShellFolder.getdetailsof(oFile,i) returns the attribute numer "i" of the file oFile.
objShellFolder.getdetailsof(objShellFolder.items,i) returns the attribute name of the
column number "i".
Different OS's return different informations.
This shows a directory list in excel. Drop a folder on the icon of the script.
I never tried to write to those fields. If you do, please report it.
Thank you.
'************************************************
' File: Directory in XL.vbs (VBScript)
' Author: Giovanni Cenati
'
' Mostra in un foglio di excel l'elenco dei
' files della directory trascinata sopra l'icona
' dello script.
' Shows the directory list in an excel sheet.
' http://digilander.libero.it/Cenati Codice vbscript
' liberamente utilizzabile citando il sito.
'************************************************
Dim oXL, oFile, objArgs,path,objShell,objShellFolder,i
dim Riga ' as the excel row where to show data
Title = "Directory in Excel - Cenati Giovanni"
Set objArgs = WScript.Arguments 'Vedo se ci sono degli argomenti passati allo script
if objargs.count=0 then 'altrimenti mostro come si usa il programma
msgbox "Trascinare una directory sul programma per averne l'elenco dei
files",vbinformation+vbokonly, Title
'msgbox "Drag a folder on the script icon to have the directory list in an excel
sheet.",vbinformation+vbokonly, Title
wscript.quit
end if
path = objArgs(0) 'questa variabile contiene il nome della directory da leggere
'Prepara l'accesso ai dati forniti dalla shell. Non funziona in Win NT4 sp6
'Creates needed objects - In WinNT Shell.app can't be instanced.
Set objShell=WScript.CreateObject("Shell.application")
Set objShellFolder=objshell.namespace(path)
'EXCEL: crea oggetto, lo rende visibile, aggiunge un foglio di lavoro.
'Creates excel sheet, make it visible, adds a workbook.
Set oXL = WScript.CreateObject("Excel.Application")
oXL.Visible = TRUE
oXL.WorkBooks.Add
'Intestazione delle colonne - Column headers
oXL.cells(1,1)= "Directory: "
oXL.cells(1,2)= path
for i=0 to 50 'Intestazioni delle colonne - Columns headers
oXL.cells(2, 1+i) = objShellFolder.getdetailsof(objShellFolder.items,i)
next
Riga=3
For Each oFile In objShellFolder.items 'recupero le informazioni sui files
'Chiede a Windows alcune altre informazioni sul file.
'Attenzione: a seconda delle versioni di windows, le colonne
'riportano dati diversi. Con winME ho il nome + 16 attributi.
'Warning: different OS report different data in different columns.
'this retrieves 50 infos + the filename (in Win ME).
for i=0 to 50
oXL.cells(Riga, 1+i) = objShellFolder.getdetailsof(oFile,i)
next
Riga=riga+1
Next
wscript.quit
'*** End ***