Jump to content
Macro Express Forums

Rfc: Assign Macro To Toolbar Button


duebel13

Recommended Posts

Today, a growing number of programs allow the user do manage toolbars (i.e. hide/unhide, add/delete, change buttons etc.). For example, there are numerous tools available that let you easily create toolbars for IE.

 

As I am getting more and more forgettable about hotkeys I would appreciate if I could add a self defined button to a either an existing or new toolbar of a certain program and associate the button click with the execution of a macro.

 

The button should be specific (aka local) to a certain program. I could easily create a global toolbar myself and assign macros to it.

Link to comment
Share on other sites

I have not studied the possibilities of doing what you are asking. There may be a way to place Macro Express macros within the toolbars of other applications and I am just not aware of it.

 

You can, however, create your own macro toolbar using the icons only feature of the floating menu type macro. You can create a series of them that are targeted to only certain programs like Word, Excel, and so forth. The macros placed in a particular toolbar would of course be scoped to particular program. And you should be able to create a "controller" macro that enables and disables a particular toolbar when a program gains or loses focus.

Link to comment
Share on other sites

Hi,

I have not organised my macros adequately by context to even attempt floating toolbars yet! - Sounds like a better idea!

I have done this for Office programs;

Here is a macro for Word03; (and 2 subs; one just checks that the correct Macro Library is loaded, one a pause 2 secs)). I have added them manually to the toolbar, (I have not automated adding them though it may be possible).

Sub MEchecker()

'

' RunME1 Macro

' Macro created 3/23/2005 by Randall Clapp

'

Dim MacEx3, strMacExpLoaded, strMacExp

strMacExpLoaded = "HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions" _

        & "\Macro Express\Miscellaneous\"

strMacExp = LCase(System.PrivateProfileString(FileName:="", _

        Section:=strMacExpLoaded, Key:="Current File"))

MacEx3 = "c:\program files\macro express3\"

If strMacExp <> MacEx3 + "formmaker14.mex" Then

    Shell (MacEx3 + "MacExp.exe" + " /F" + MacEx3 + "FormMaker14.mex")

MEpauser2

    strMacExp = LCase(System.PrivateProfileString(FileName:="", _

        Section:=strMacExpLoaded, Key:="Current File"))

       MsgBox ("Not Loaded FormMaker14.mex" + strMacExp)

       GoTo ender3

    Else

       'MsgBox ("Loaded FormMaker14.mex")

End If

GoTo ender4

ender3:

'MsgBox ("Error; ? Wrong macro Library loaded?" + ";" + strMacExp)

ender4:

'MsgBox ("End of Sub2")

End Sub

Sub MEpauser2()

'

' Macro created 3/23/2005 by Randall Clapp

'

PauseTime = 2

    Start = Timer    ' Set start time.

        Do While Timer < Start + PauseTime

            DoEvents    ' Yield to other processes.

        Loop

End Sub

Sub DestinationDirectory()

'

' DestinationDirectory Macro

' Macro created 3/23/2005 by Randall Clapp

'

Dim MacEx3, strSection, strPicker, strDestination

MacEx3 = "c:\program files\macro express3\"

MEchecker

On Error Resume Next

Shell (MacEx3 + "MEPROC.EXE /ADestinationXcopyGUI")

End Sub

You would just add the 3rd quoted macro to the toolbar, the first 2 subs just to the macrolist (the first checks the registry key for currently running library name) by "create" etc(my subs are called by a number of macros). (Obviously use your own library file and macro names as appropriate)

Randall

Link to comment
Share on other sites

And you should be able to create a "controller" macro that enables and disables a particular toolbar when a program gains or loses focus.

This controller macro proposal sounds like an acceptable workaround.

 

Of course I would prefer to work with a single window. But if it is possible to have the global toolbar always on top without stealing the focus from the application window that would be sufficient.

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...