How to access Excel from Word
I want to scan a system for open Excel workbooks.
Sub GetExcelData()
Dim WB As Workbook
For Each WB In Application.Workbook
If MsgBox("Do you want " & WB.Name, vbYesNo) = vbYes Then
MsgBox ("Yes")
End If
Next WB
End Sub
The compiler complain and thinks that workbook is a user defined type.
I do have the "Microsoft Office 16.0 Object Library" checked.
What am I missing.
Thanking you in advance (I have done Excel VBA for years but just starting Word)
|