Bonjour

Il n'y a apparemment aucune erreur dans cette macro, et encore moins
dans la ligne mentionnée.

Sinon joins nous ton code par copier-coller.

Francois Gatto

Jean Sympa a écrit :
> Merci Laurent,
> 
> 
> Main est passé à la trappe.
> 
> J'ai une erreur dès la première ligne; cette difficulté me dépasse.
> 
> 
> sub traite_eml
> 
> 
>   dim prop(0) as new com.sun.star.beans.PropertyValue '*Erreur de
> syntaxe Basic*
> 
>    prop(0).name = "FilterName"
> 
>     prop(0).value = "Text"
> 
> 
>    doc = thisComponent
> 
>    cherche = array("=E9", "=E0" ,"=9C" , "=E8" , "=F4" )
> 
>    remplace= array ("é","à","œ", "é", "ô")
> 
>   
>    for i=lbound(cherche) to ubound(cherche)
> 
>        call rechercheRemplace(doc, cherche(i), remplace(i))
> 
>    next i
> 
> msgbox "Fin du traitement"
> 
> 
> end sub
> 
> 
> Cordialement
> 
> Papy
> 
> 
> //************************************************************************************************************************************
> 
> Jean Sympa a écrit :
>> Merci Laurent,
>>
>>
>> J'essaie d'adapter ton ébauche. Tu as traité le cas où les fichiers
>> *.eml étaient réunis dans un même répertoire. Ces fichiers étant
>> dispersés dans des répertoires, je veux traiter individuellement
>>
>> ceux qui m'intéressent.
>>
>> Mon hypothèse de travail est :
>>
>> J'ouvre un fichier et je lance la macro de conversion.
>>
>>
>> Je m'inspire du chapitre 10 de la bible, acquise en 2006, qui n'est
>> donc pas la dernière édition.
>>
>>
>> Je dois éliminer la recherche des fichiers dans les différents
>> répertoires.
>>
>>
>>
>> //*** Ta proposition, à titre de rappel
>>
>> sub traite_eml()
>>
>>
>> dim prop(0) as new com.sun.star.beans.PropertyValue
>>
>> prop(0).name = "FilterName"
>>
>> prop(0).value = "Text"
>>
>>
>> doc = thisComponent
>>
>>
>> cherche = array("=E9", "=E0" ,"=9C" , "=E8" , "=F4" )
>>
>> remplace= array ("é","à","œ", "é", "ô")
>>
>>
>> for i=lbound(cherche) to ubound(cherche)
>>
>> call rechercheRemplace(doc, cherche(i), remplace(i))
>>
>> next i
>>
>>
>>
>> end sub
>>
>> sub traite_eml(fichier)
>>
>>
>> dim prop(0) as new com.sun.star.beans.PropertyValue
>>
>> prop(0).name = "FilterName"
>>
>> prop(0).value = "Text"
>>
>>
>> doc =
>> stardesktop.loadComponentFromURL(convertToURL(fichier),"_blank",0,
>> prop())
>>
>> cherche = array("=E9", "=E0" ,"=9C" , "=E8" , "=F4" )
>>
>> remplace= array ("é","à","œ", "é", "ô")
>>
>> for i=lbound(cherche) to ubound(cherche)
>>
>> call rechercheRemplace(doc, cherche(i), remplace(i))
>>
>> next i
>>
>>
>>
>> end sub
>>
>> //*** Travail personnel
>>
>>
>>
>> Sub Main
>>
>>
>> Dim monDocument As Object
>>
>> monDocument = ThisComponent
>>
>>
>>    *<--- Erreur de syntaxe BASIC*
>>
>>  
>>
>> call traite_eml
>>    msgbox "Fin du traitement du fichier"
>>
>>
>> On Error Resume Next 'ignorer l'erreur éventuelle
>>
>>   On Error Goto 0 ' reprendre le traitement d'erreur normal
>>
>> End Sub
>>
>>
>> sub traite_eml
>>
>>
>>    'dim prop(0) as new com.sun.star.beans.PropertyValue
>>
>>    'prop(0).name = "FilterName"
>>
>>    'prop(0).value = "Text"
>>
>>
>>    'doc =
>> stardesktop.loadComponentFromURL(convertToURL(fichier),"_blank",0,
>> prop())       cherche = array("=E9", "=E0" ,"=9C" , "=E8" , "=F4" )
>>
>>    remplace= array ("é","à","œ", "é", "ô")
>>
>>      for i=lbound(cherche) to ubound(cherche)
>>
>>        call rechercheRemplace(doc, cherche(i), remplace(i))
>>
>>    next i
>>
>>
>>
>> end sub
>>
>>
>> //**************************************************************************************************************
>>
>> Laurent Godard a écrit :
>>> Bonjour jean
>>>
>>> tu lances directement cette version modifiée
>>>
>>> pour le repertoire, il te suffit d'adapter la variable chemin_eml
>>> avec le nom du repertoire contenant ta collection de fichiers eml
>>>
>>> sub traite_eml()
>>>
>>>     dim prop(0) as new com.sun.star.beans.PropertyValue
>>>     prop(0).name = "FilterName"
>>>     prop(0).value = "Text"
>>>
>>>     doc = thisComponent
>>>
>>>     cherche = array("=E9", "=E0" ,"=9C" , "=E8" , "=F4" )
>>>     remplace= array ("é","à","œ", "é", "ô")
>>>
>>>     for i=lbound(cherche) to ubound(cherche)
>>>         call rechercheRemplace(doc, cherche(i), remplace(i))
>>>     next i
>>>
>>>
>>> end sub
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: prog-unsubscr...@fr.openoffice.org
>>> For additional commands, e-mail: prog-h...@fr.openoffice.org
>>>
>>>
>>>
>>
>>
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: prog-unsubscr...@fr.openoffice.org
For additional commands, e-mail: prog-h...@fr.openoffice.org

Répondre à