Pages : 1
#1 Le 09/08/2008, à 11:55
- Peadar
OpenOffice - Macro Calc
Bonjours,
J'ai actuellement un problème pour adapter ma macro en vb que j'utilise sous exel pour calc.
J'ai chercher un peut partout, modifier mon code a mainte reprise mais rien, je vous met la macro au cas ou qu'une personne sache l'adapter pour qu'elle fonctionne sous calc.
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Private Sub Import_Data()
Dim Fichier As Variant
Dim NumFichier As Integer
ClasseurRéférence = ActiveWorkbook.Name
Set fichcherche = Application.FileSearch
x = fichcherche.FoundFiles.Count
With fichcherche
NumFichier = FreeFile
iRow = 2
.LookIn = "C:\Documents and Settings\<username>\Mes Documents"
.Filename = "*.txt"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Open .FoundFiles(i) For Input As #NumFichier
For j = 1 To 2
iCol = 2
Line Input #NumFichier, Chaine
Ar = Split(Chaine, ",")
For k = LBound(Ar) To UBound(Ar)
Cells(3, 3) = Ar(0)
iCol = iCol + 1
Next
Next
Close #NumFichier
Next i
Else
MsgBox "Aucun fichier n'a été trouvé."
End If
End With
End Sub
Hors ligne
Pages : 1