Question MSFlexgrid vers un fichier .dat

  • vendredi 28 août 2009 17:04
     
      A du code
    Bonjour a tous,

    Je rencontre un problème avec un code:
    Dim MyFreeFile As Integer
    Dim icol As Integer
    Dim irow As Integer
    Dim MyString As String
    MyFreeFile = FreeFile
    Open "C:\Documents and Settings\All Users\Desktop\ord" For Output As MyFreeFile
    For irow = 1 To MSFlexGrid1.Rows - 1    'Start from top to bottom
        For icol = 0 To MSFlexGrid1.Cols - 1    'Start from left to Right
            MyString = MyString & MSFlexGrid1.TextMatrix(irow, icol) & _
                IIf((icol = MSFlexGrid1.Cols - 1), "", ",")     'Add value in mystring for each column in Flexgrid
        Next
        Print #MyFreeFile, MyString  'Print to notepad
        MyString = ""   'Reset MyString
    Next
     
    Close MyFreeFile
    
    Avec ce code, je voudrais le modifier afin de pouvoir posisionner chaque colonne du msflexgrid a des possision spécifique.

    Exemple du msflexgrid:
    Colonne 1 ligne 1 du Grid = "H"
    Colonne 2 ligne 1 du Grid = "A"
    Colonne 3 ligne 1 du Grid = "HOST"
    Colonne 4 ligne 1 du Grid = "08989" etc.

    Example de possision pour le fichier .dat:
    Colonne 1 ligne 1 du Grid = Possision 1
    Colonne 2 ligne 1 du Grid = Possision 2
    Colonne 3 ligne 1 du Grid = Possision 3
    Colonne 4 ligne 1 du Grid = Possision 9.

    Ce qui donnerais comme résultat final dans le fichier dat:
    "HAHOST   08989"

    Comment faire s.v.p?

    Merci encore pour votre aide.