Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Wed, 7 May 2008 06:09:59 -0700 (PDT),    group: microsoft.public.word.customization.menustoolbars        back       


Custom Ribbon to call Macros from a template   
I have a bunch of macros that work great for a lot of repetative tasks
that my company performs on a regular basis.  My company just upgraded
to office 2007 and while the macros are still there and working in the
Add-Ins tab, I would like them to available in a template file that
adds a new tab.

What I have done so far is create a macro enabled template (Test.dotm)
and added my macros to this template.

One example is the macro labeled as "Commands.Cleanup"  This name
comes from the macros menu in a new document with the custom template
added in the "Templates and Addins" area.

Using the microsoft recommended program "Office 2007 Custom UI
Editor", I added the following code to test.dotm:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui">
	<ribbon startFromScratch="false">
		<tabs>
			<tab id="customTab" label="Custom Tab">
				<group id="customGroup" label="Custom Group">
					<button id="customButton" label="Custom Button"
imageMso="HappyFace" size="large" onAction="Commands.Cleanup" />
				</group>
			</tab>
		</tabs>
	</ribbon>
</customUI>

BTW, this program changes to rels file for you, so this is done.

Now I left all the labels and icon as the default sample just to play
around, but change the onAction to Custom.Cleanup.  The new Custom Tab
now shows up in word, but clicking the icon gives me the message
"Microsoft Visual Basic: Wrong number of arguments or invalid propery
assignment".

This macro works, so that isnt the issue. Its very simple anyways. It
just fixes some spacing issues. I have even tried a simple message box
macro, and that gives me the same message.  I should also point out
that the template is in a trusted location and macro settings are on
enable all macros.

My goal is to make an easily distributable template file that can be
added in easily with a nicely laid out tab that calls my old macros.
Anyone know what I am doing wrong?
date: Wed, 7 May 2008 06:09:59 -0700 (PDT)   author:   unknown

Re: Custom Ribbon to call Macros from a template   
Hi,

> My goal is to make an easily distributable template file that can be
> added in easily with a nicely laid out tab that calls my old macros.
> Anyone know what I am doing wrong?

your Sub need the following argument:

Public Sub Cleanup(ctrl As IRibbonControl)
   '... your code
End Sub

or

Public Sub Cleanup(Optional ctrl As IRibbonControl)
   '... your code
End Sub


Mit freundlichen GrĂ¼ssen
Melanie Breden

-MVP Excel-
date: Wed, 7 May 2008 16:07:33 +0200   author:   Melanie Breden

Re: Custom Ribbon to call Macros from a template   
The information provided here might help:
http://gregmaxey.mvps.org/Customize_Ribbon.htm


gandl098-00@yahoo.com wrote:
> I have a bunch of macros that work great for a lot of repetative tasks
> that my company performs on a regular basis.  My company just upgraded
> to office 2007 and while the macros are still there and working in the
> Add-Ins tab, I would like them to available in a template file that
> adds a new tab.
>
> What I have done so far is create a macro enabled template (Test.dotm)
> and added my macros to this template.
>
> One example is the macro labeled as "Commands.Cleanup"  This name
> comes from the macros menu in a new document with the custom template
> added in the "Templates and Addins" area.
>
> Using the microsoft recommended program "Office 2007 Custom UI
> Editor", I added the following code to test.dotm:
>
> <customUI xmlns="http://schemas.microsoft.com/office/2006/01/
> customui">
> <ribbon startFromScratch="false">
> <tabs>
> <tab id="customTab" label="Custom Tab">
> <group id="customGroup" label="Custom Group">
> <button id="customButton" label="Custom Button"
> imageMso="HappyFace" size="large" onAction="Commands.Cleanup" />
> </group>
> </tab>
> </tabs>
> </ribbon>
> </customUI>
>
> BTW, this program changes to rels file for you, so this is done.
>
> Now I left all the labels and icon as the default sample just to play
> around, but change the onAction to Custom.Cleanup.  The new Custom Tab
> now shows up in word, but clicking the icon gives me the message
> "Microsoft Visual Basic: Wrong number of arguments or invalid propery
> assignment".
>
> This macro works, so that isnt the issue. Its very simple anyways. It
> just fixes some spacing issues. I have even tried a simple message box
> macro, and that gives me the same message.  I should also point out
> that the template is in a trusted location and macro settings are on
> enable all macros.
>
> My goal is to make an easily distributable template file that can be
> added in easily with a nicely laid out tab that calls my old macros.
> Anyone know what I am doing wrong?
date: Wed, 7 May 2008 20:00:28 -0400   author:   Gregory K. Maxey RrOMEOgOLF

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us