Utilisation d'un paramétre

Résolu
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. 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 !
    1. 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+.