What workbook or worksheet has the focus? vb6
Posted on 2004-09-25
I have few workbooks open. User may click on any of the workbooks or worksheets. I have a time event, and in it, I would like to findout what is worksheet name and the full path of the workbook. I guess us of GetObject is out of question becuse the process is in reverse in this case.
This code is excel version, I need to change it to work in vb environment:
Dim ws As Worksheet
Dim wbbk As Workbook
Set ws=ActiveSheet '<-- I am getting error here,
MsgBox wb.Path & ", " & ws.Name
If I use GetObject, I need to supply the name of workbook and it will then send the focus to the supplied workbook not the one which had the focus (was active).
I hope it is clear what I am looking for.