Hallo zusammen,
ich stoße für etliche Dateien >500 aus einem Verzeichnis mittels einer Schleife folgendes Sub an.
Das ganze gestaltet sich als sehr zeitintensiv.
Besteht die Möglichkeit dies mittels Async und Await aufzurufen?
Und lässt sich dann ermitteln wenn alle Hintergrundprozesse abgeschlossen sind?
Mit den Beispielen bzw. der Doku auf Docs bin ich nicht weitergekommen.
Vielen Dank.
Daniel
ich stoße für etliche Dateien >500 aus einem Verzeichnis mittels einer Schleife folgendes Sub an.
Das ganze gestaltet sich als sehr zeitintensiv.
VB.NET-Quellcode
- Sub ExcelPrepare(FilePath As String, TranslateName As String)
- Dim xlApp As New Excel.Application
- Dim xlWorkBook As Excel.Workbook
- Dim xlWorkSheet As Excel.Worksheet
- Dim Translation() As String = TranslateName.Split(CChar(";"))
- Dim TranslationPair() As String
- Dim i As Integer
- Dim ii As Integer
- xlWorkBook = xlApp.Workbooks.Open(FilePath)
- xlWorkSheet = CType(xlWorkBook.Sheets(1), Excel.Worksheet)
- Dim suchbereich As Excel.Range = CType(xlWorkSheet.Rows(1), Excel.Range)
- With xlWorkSheet
- .Range(2 & ":" & 2).Delete()
- For i = 0 To Translation.Length - 1
- TranslationPair = Translation(i).Split(CChar(":"))
- For ii = 0 To TranslationPair.Length - 1
- Dim c As Excel.Range
- Dim firstAddress As String
- With xlWorkSheet.Range("1:1")
- c = .Find(TranslationPair(0), LookIn:=Excel.XlFindLookIn.xlValues)
- If c IsNot Nothing Then
- firstAddress = c.Address
- Else
- firstAddress = Nothing
- End If
- End With
- If firstAddress <> Nothing Then
- .Range(firstAddress).Value = TranslationPair(1)
- End If
- Next ii
- Next i
- End With
- xlWorkBook.Close(SaveChanges:=True)
- End Sub
Besteht die Möglichkeit dies mittels Async und Await aufzurufen?
Und lässt sich dann ermitteln wenn alle Hintergrundprozesse abgeschlossen sind?
Mit den Beispielen bzw. der Doku auf Docs bin ich nicht weitergekommen.
Vielen Dank.
Daniel