Utilisation d'un paramétre

Résolu
Napalawow Messages postés 38 Statut Membre -  
Napalawow Messages postés 38 Statut Membre -
Slt salut,

J'ai une petite fonction qui fait appel à une autre fonction
Sub siteun()

    ouvrirfichier blabla

End Sub

"blabla" est un string

Sub ouvrirfichier(reponse)
Dim Repertoire As String
Dim MaDate As String
MaDate = Format(Date, "yyyy-mm-dd")

MsgBox Repertoire & "\" & reponse & "_Data10min_" & MaDate & ".txt"

Workbooks.OpenText Filename:="C:\Documents and Settings\Alluser\Bureau\JDH"\" & reponse & "_Data10min_" & MaDate & ".txt"

End Sub


Avec la MsgBox je remarque que le paramètre reponse n'y est pas c'est-à-dire qu'il m'affiche pas blabla mais que =>
"_Data10min_2005-05-03.txt"

J'espere avoir été assez clair
Voila merci pour les aides à venir...
Configuration: Windows XP
Firefox 2.0.0.14

2 réponses

  1. amigo
     
    Bonour,

    si blabla est le nom d'une variable string alors il faut ecrire:
    blabla="blabla"
    ouvrirfichier ( blabla)

    sinon c'est la syntaxe suivante:
    Sub siteun()
    
        ouvrirfichier("blabla")
    
    End Sub
    
    Sub ouvrirfichier(reponse)
    Dim Repertoire As String
    Dim MaDate As String
    
    MaDate = Format(Date, "yyyy-mm-dd")
    
    Repertoire="C:\Documents and Settings\Alluser\Bureau\JDH"
    
    MsgBox Repertoire & "\" & reponse & "_Data10min_" & MaDate & ".txt"
    
    Workbooks.OpenText Filename:=Repertoire  & "\" & reponse & "_Data10min_" & MaDate & ".txt"
    
    End Sub
    


    A+.
    0
  2. Napalawow Messages postés 38 Statut Membre 1
     
    OK super sympa AMIGO

    Merci encore, il fallait comme tu le dis (si bien) écrire :
    ouvrirfichier "blabla"
    


    Bon allez +1 problème résolu (ça à l'air si facile ...)
    merci encore Amigo !
    0