Writing custom function..

M

MS

Hi all,
I want to record all the events in an excel sheet. Please guide me how to
write a function in VB that can perform this.
In other words, the function would work similar to the Record macro function
in Excel. Please suggest.
Thanks.
 
G

Gale Green

Hi all,
I want to record all the events in an excel sheet. Please guide me how to
write a function in VB that can perform this.
In other words, the function would work similar to the Record macro function
in Excel. Please suggest.

I don't think you can do this very easily, but you could try asking on
an Excel newsgroup.

If you set a reference to the Excel Object Library in your VB project,
then, at form level,

Dim WithEvents XLApp As Excel.Application

and, in Form_Load, or a button Click Event, or similar,

Se XLApp = New Excel.Application

Then, select XLApp in the object drop-down at the top-left of the code
window and you will see a whole range of events that you can trap in
the right-hand drop-down.

However, Excel will not report every mouse click and cursor movement.
For example, there is the SheetBeforeRightClick event and the
SheetBeforeDoubleClick event, but no SheetBeforeClick event.

And I don't think it reports keyboard activity at all.

Gale.
 
T

Tushar Mehta

Ummm...why not use the macro recorder?

Other than that -- and even it is far from perfect -- there is no way
to record *everything* that happens -- at least not within XL. You
could get one of those spy programs, something that records all
keystrokes and mouse movements. What you would do with the log is
something you would have to figure out.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top