G
Guest
Hi,
I am trying to learn VB.Net and I am now going insane trying to get the active Excel document. The only thing I really need is to get the active document and read/set some of its properties. I have unsuccessfully tried numeros ways, including something like:
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim myBookName As String
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.ActiveWorkbook, Excel.Workbook)
myBookName = xlBook.Name
What am I doing wrong, and what must I do to get the active workbook and things like its name?
TIA
/ Richard
I am trying to learn VB.Net and I am now going insane trying to get the active Excel document. The only thing I really need is to get the active document and read/set some of its properties. I have unsuccessfully tried numeros ways, including something like:
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim myBookName As String
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.ActiveWorkbook, Excel.Workbook)
myBookName = xlBook.Name
What am I doing wrong, and what must I do to get the active workbook and things like its name?
TIA
/ Richard