04-11-2021
09:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-11-2021
09:59 AM
Hello
You can try following
Add in the Header of your rule
AddReference "Microsoft.Office.Interop.Excel.dll"
Imports Microsoft.Office.Interop
Imports System.Runtime.InteropServices
In your rule add
Dim objApp As Excel.Application= TryCast(Marshal.GetActiveObject("Excel.Application"), Excel.Application)
If objApp IsNot Nothing Then
Dim objBooks As Excel.Workbooks
objBooks = objApp.Workbooks
Dim objBook As Excel._Workbook
For Each objBook In objBooks
If objBook.Name= "Document-Name_With-Extension-Without_Path" Then
'If objBook.FullName= "DocumentName_With-FullPath-and-Extension" Then 'alternative, if document name alone is not specific enough
objBook.Close
Exit For
End If
Next
End If
R. Krieg
RKW Solutions
www.rkw-solutions.com