Home All Groups Group Topic Archive Search About

Can I use VB to run a macro in any Microsoft application?

Author
1 May 2006 4:16 PM
Neji
Can I use VB to run a macro in any Microsoft application?

My goal is to place the following in a macro: "Alt+tab, Alt+spacebar,
'M', left mouse click".  This will allow me to switch mouse focus when
I switch applications.

The problem is that I've only made VBA scrips in Excel, and I don't
think that these VBA macros work outside of Excel.  Can VB be used
outside of Excel?  Is this something that can be done in .NET or
regular VB?

Author
1 May 2006 4:53 PM
Jeff Dillon
Using SendKeys like that is always a bad idea. You are "assuming" the window
has the focus, but you never really know. Automation is the way to go


Show quoteHide quote
"Neji" <chillyn***@yahoo.com> wrote in message
news:1146500213.904079.267650@i39g2000cwa.googlegroups.com...
> Can I use VB to run a macro in any Microsoft application?
>
> My goal is to place the following in a macro: "Alt+tab, Alt+spacebar,
> 'M', left mouse click".  This will allow me to switch mouse focus when
> I switch applications.
>
> The problem is that I've only made VBA scrips in Excel, and I don't
> think that these VBA macros work outside of Excel.  Can VB be used
> outside of Excel?  Is this something that can be done in .NET or
> regular VB?
>