ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
373
373
EMPFEHLEN
-
--------------------------------------------------------------------------------
Hallo zusammen,
ich würde gern das Marko in ein VB.NET umschreiben kann mir jemand helfen?
Public Function GetXLFiles(ByRef astrXLFiles() As String, _
ByVal strLookIn As String, Optional fSearchSubfolders _
As Boolean = False) As Boolean
Dim nFilesCnt As Long
Dim nFile As Long
Dim nCounter As Long
Dim strFileName As String
On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = strLookIn
.SearchSubFolders = fSearchSubfolders
.Filename = ".xls"
.FileType = msoFileTypeExcelWorkbooks
If .Execute(SortBy:=msoSortByFileName, SortOrder:= _
msoSortOrderAscending, AlwaysAccurate:=True) > 0 Then
nFilesCnt = .FoundFiles.Count
ReDim astrXLFiles(0 To nFilesCnt - 1)
nCounter = -1
For nFile = 1 To nFilesCnt
strFileName = .FoundFiles(nFile)
If Len(Dir$(strFileName)) > 0 Then
nCounter = nCounter + 1
astrXLFiles(nCounter) = strFileName
End If
Next
If nCounter > -1 Then
ReDim Preserve astrXLFiles(0 To nCounter)
GetXLFiles = True
End If
End If
End With
On Error GoTo 0
End Function
Public Sub Demo()
Dim strPath As String
Dim astrXLFiles() As String
Dim nFile As Long
strPath = "c:\test\"
If Len(Dir$(strPath, vbDirectory)) > 0 Then
If GetXLFiles(astrXLFiles(), strPath, True) Then
For nFile = 0 To UBound(astrXLFiles)
Debug.Print astrXLFiles(nFile)
Workbooks.Open astrXLFiles(nFile), UpdateLinks:=3
ActiveWorkbook.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
ActiveWorkbook.Close
Next
Erase astrXLFiles
Else
MsgBox "Keine Excel-Arbeitsmappen im Verzeichnis " & _
vbCrLf & strPath & vbCrLf & "gefunden!", _
vbInformation, "DEMO"
End If
Else
MsgBox "Das Verzeichnis " & vbCrLf & strPath & vbCrLf & _
"existiert nicht!", vbInformation, "DEMO"
End If
End Sub
DANKE im Vorraus
Miles
-
08.07.05 21:18 #2
- Registriert seit
- Jan 2004
- Ort
- Paderborn
- Beiträge
- 1.210
Wobei sollen wir dir denn helfen?
Fang doch einfach mal selber an und wenn du konkrete Fragen hast, dann kannst du sie hier stellen.
Ich glaube nicht, dass sich einer die Mühe macht und dir das komplette konvertieren abnimmt
Ähnliche Themen
-
» Excel [Excel 2003] 2007er Skript funktioniert unter 2003er Excel nicht
Von DarthShader im Forum Office-AnwendungenAntworten: 1Letzter Beitrag: 24.08.10, 12:18 -
Excel 2007 PivotTools (PTTools) von Excel erzeugte MDX Statements mitschneiden
Von Thomas Darimont im Forum Office-AnwendungenAntworten: 0Letzter Beitrag: 17.07.09, 10:08 -
[Excel] Inhalt einer Excel Datei als neues Tabellenblatt einfügen
Von hauke1981 im Forum Office-AnwendungenAntworten: 1Letzter Beitrag: 14.12.08, 19:02 -
VBA-Excel:Interner Fehler!Schliessen von Excel: Hilfe -weiss nicht weiter
Von SoltanDemoriel im Forum Visual Basic 6.0Antworten: 4Letzter Beitrag: 03.05.07, 16:48 -
excel spreadsheet Excel writer - Formel über Arbeitsplätter hinweg
Von südpol im Forum PHPAntworten: 0Letzter Beitrag: 10.02.05, 14:58





Zitieren
Login





