Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1046,9 +1046,16 @@ Namespace ExcelOps

''' <inheritdoc/>
Public Overrides Sub RemoveVbaProject()
If Me.Workbook.VbaProject IsNot Nothing Then
Me.Workbook.VbaProject.Remove()
End If
Try
If Me.Workbook.VbaProject IsNot Nothing Then
'known to fail with files saved by newer MS Excel versions
'failure is not critical since next Me.Workbook.RemoveVBAProject() also does some cleanups to delete VBA from file
'=> so we just ignore these errors here
Me.Workbook.VbaProject.Remove()
End If
Catch ex As NullReferenceException
Catch ex As System.IO.EndOfStreamException
End Try
Me.Workbook.RemoveVBAProject()
End Sub

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,9 +1046,16 @@ Namespace ExcelOps

''' <inheritdoc/>
Public Overrides Sub RemoveVbaProject()
If Me.Workbook.VbaProject IsNot Nothing Then
Me.Workbook.VbaProject.Remove()
End If
Try
If Me.Workbook.VbaProject IsNot Nothing Then
'known to fail with files saved by newer MS Excel versions
'failure is not critical since next Me.Workbook.RemoveVBAProject() also does some cleanups to delete VBA from file
'=> so we just ignore these errors here
Me.Workbook.VbaProject.Remove()
End If
Catch ex As NullReferenceException
Catch ex As System.IO.EndOfStreamException
End Try
Me.Workbook.RemoveVBAProject()
End Sub

Expand Down
Loading