Wie suchen Sie nach der letzten leeren Zelle in einem Excel-Blatt von einem vsto Outlook Addin?vsto - VB - letzte Zelle aus der Spalte in Outlook finden addin
Ich habe den folgenden Code (nicht kompilieren)
Imports Excel = Microsoft.Office.Interop.Excel
Dim ExcelApp As New Excel.Application
Dim ExcelWorkbook As Excel.Workbook
Dim ExcelWorkSheet As Excel.Worksheet= ExcelWorkbook.Worksheets(1)
Dim ExcelRange As Excel.Range = ExcelWorkSheet.Range("A1","A600")
Dim currentFind As Excel.Range = Nothing
Dim firstFind As Excel.Range = Nothing
currentFind = ExcelRange.Find("*", , Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
While Not currentFind Is Nothing
' Keep track of the first range you find.
If firstFind Is Nothing Then
firstFind = currentFind
' If you didn't move to a new range, you are done.
ElseIf currentFind.Address = firstFind.Address Then
Exit While
End If
currentFind = ExcelRange.FindNext(currentFind)
End While
ExcelWorkbook.ActiveSheet.range(currentFind).Select()
ich es nach Scott Holtzman Kommentare aktualisiert haben, aber jetzt bekomme ich eine Fehlermeldung: HRESULT: 0x800A03EC
Bitte posten Sie Lösungen als Antworten nicht als Updates für die Frage. Dies dient dazu, Verwirrung für zukünftige Besucher zu vermeiden. Die Änderungen gehen nicht verloren und Sie können sie in Ihren [Revisionen] (https://stackoverflow.com/posts/46711104/revisions) abholen. – Bugs