Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2014, 11:00 PM
Dimsok Dimsok is offline Macros for starting macroses Windows XP Macros for starting macroses Office 2007
Advanced Beginner
Macros for starting macroses
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default Macros for starting macroses

How can i start with macros some other macros/es?
Reply With Quote
  #2  
Old 09-16-2014, 11:22 PM
macropod's Avatar
macropod macropod is offline Macros for starting macroses Windows 7 64bit Macros for starting macroses Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You simply call them from the macro you want to run the from. For example:
Code:
Sub Main()
  Call Macro1
  Call Macro2("Hello World")
End Sub
 
Sub Macro1()
  MsgBox "Macro1 reporting for duty"
End Sub
 
Sub Macro2(strTxt As String)
  MsgBox strTxt
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-16-2014, 11:28 PM
Dimsok Dimsok is offline Macros for starting macroses Windows XP Macros for starting macroses Office 2007
Advanced Beginner
Macros for starting macroses
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

I found out already. I can use:

HTML Code:
Sub myMacros()
SortMacroI
MyB
End Sub
Or your exampled methods are better?

And it's not possible to start macroses from add-ins? "SpeakFromCursor" I can assign hotkey for it, but i can't start it from macros. Maybe some macros to start the same hotkey which i assign for that addin's macros?
Reply With Quote
  #4  
Old 09-16-2014, 11:42 PM
macropod's Avatar
macropod macropod is offline Macros for starting macroses Windows 7 64bit Macros for starting macroses Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The only real difference between my example and yours is that I've prefixed the macro name with Call. IMHO that makes it easier to see where the code is referencing another macro.

As for starting a macro in an addin, you'd need to both reference the addin and call its macro with all of the required parameters. Note how the second called macro in the example I posted requires a text string to be included in the call.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-16-2014, 11:48 PM
Dimsok Dimsok is offline Macros for starting macroses Windows XP Macros for starting macroses Office 2007
Advanced Beginner
Macros for starting macroses
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

i can't view addin's macro code. I want to add that command to the new tab but i can't use "callback". So what if i will assing hotkey for it, for example alt+O and then use own macro to start that hotkey combo with callback. So can you example macro to launch hotkey alt+O?
Reply With Quote
  #6  
Old 09-16-2014, 11:55 PM
macropod's Avatar
macropod macropod is offline Macros for starting macroses Windows 7 64bit Macros for starting macroses Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For that, you could try using SendKeys:
SendKeys "%O"
but do note this will only work while the document's main window is active.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros for starting macroses starting a task at half day ketanco Project 3 05-13-2014 07:16 AM
Macros for starting macroses Sections starting on even page Eva Word 1 11-05-2011 01:20 PM
Macros for starting macroses Starting Word Problem GeorgeVoudouris Word 4 09-07-2011 03:39 AM
Macros for starting macroses Starting Over zoeshaus Outlook 4 06-16-2010 12:20 PM
Error Starting MS Help Renee Hendershott Office 0 01-22-2006 03:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft