PDA

View Full Version : Solved: “Custom UI Editor” — can it craft LARGER icons (for either Word 2007 or 2010)?



Ice-Tea-Jan
11-27-2010, 11:09 AM
Hello :hi:

So I’ve experimented with the Custom UI Editor to “sort of” replace Word’s old 2003 toolbars.

Many thanks to Greg & Gerri for pointing out some alternatives.

However, there are some areas that I am disappointed with. . .


1. Small size of icons.
Is there a way (via Word or UI Editor) to remedy that?




2. Not able to “drag/float/undock” the tabs.
I need to either SEE the icons better, or drag the icons near the copy for which a macro might be invoked against.

3. Sharing the customized ribbon file is awkward
Sharing my ribbon customization file with another user means they would in turn lose their own ribbon customizations. Of course they could export & save their own ribbon customizations first, then import mine, and then reimport their own customization back again. But this seems awkward.





I wanted something that would add, but not interfere with the user’s ribbon.

Crafting macros for the Quick Access Toolbar seems limited, since the icon pictures are still small, they are limited to a certain pre-defined selection, and you can’t modify them. Also you can’t seem to “stack/group” them as I was able to do with Word 2003 toolbars.
I know that templates transitioned from Word 2003 will “add-in”; but they also carry the same issues described in 1 & 2 above, and transitioning templates from 2003 will soon be an extinct process (for me anyway).
Is there a way to make ribbon customizations act like an Add-In? : pray2:

I see something about “Document Related to Add-Ins” in Word 2010. Am I on the right track here?




I have Word 2010 at home, and will eventually have Word 2007 at work.

Any insight is very much appreciated.

Janet

Paul_Hossler
11-27-2010, 01:51 PM
Your 1. In the XML, you can use size = "large' to make an icon larger


<toggleButton id="ToggleButton1"
size="large"
label="Large Toggle Button"
getPressed="MyToggleMacro"
onAction="MyActionMacro"
screentip = "This is a normal type of screentip"
supertip = "This is a normal type of screentip This is a normal type of screentip"
/>


Your 3. I add my own tab or group to keep the additional functions togeather and transportable with the document.

Customizing the QAT and making it transportable is probably not easy. I've read that there's issues, but have not really tried it

I've made add ins that adds a tab to the user's ribbon that is always there and make the add in's functions available

Do you have a specific example of what you are looking to do?

Paul

Ice-Tea-Jan
11-27-2010, 03:01 PM
Paul,

Thanks for your prompt answers. I shall try the “large” in XML.

A more specific question (example) . . .

The attached document has two tabs that I made via the Custom UI editor. They are named “My tab” and “SecondMy Tab.”

I would like to “export” them to other users as an add-in, that is: without overwriting the receiver’s entire ribbon. Is this possible? Am I missing something very obvious?:dunno

Thanks!
Janet

Paul_Hossler
11-27-2010, 04:25 PM
1. you had myimage and myImage in the CustomUI - they get treated as different since it's case-sensitive

2. I think that you'll need 2 sections in the CustomUI to use in 2007 and 2010. You have CustomUI14 which is 2010. If you used CustomUI (2007) then you could use it for both (at least I have ). Not exactly sure if that's how the 2 sections work.


<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab"label="My Tab">
<group id="sampleGroup"label="Sample Group">
<button id="button1"label="Click Me"
size="large"imageMso="HappyFace"
onAction="myButtonMacro" />
<button id="button2"label="Click Me Too"
size="large"image="myImage"
onAction="myButtonMacro" />
</group >
</tab>
<tab id="SecondcustomTab"label="SecondMy Tab">
<group id="SecondsampleGroup"label="SecondSample Group">
<button id="Secondbutton1"label="SecondClick Me"
size="large"imageMso="HappyFace"
onAction="myButtonMacro" />
<button id="Secondbutton2"label="Click Me Too"
size="large"image="myImage"
onAction="myButtonMacro" />
</group >
</tab>
</tabs>
</ribbon>
</customUI>



3. Save it as a macro enabled template (dotm)

4. In Vista and Win7, I put the DOTM in C:\Users\<userid>\AppData\Roaming\Microsoft\Word\STARTUP

5. When Opening or creating a working document (docx) the new tabs should be there, along with the original tabs.

6. Since the macros are the loaded template and not the active document, you have to be very careful to use ActiveDocument and ThisDocument in your termplate macros

I tweaked your sample -- it should help get you started -- so just save it without the .zip part since you cannot upload a .dotm file directly


Paul

Ice-Tea-Jan
11-28-2010, 03:50 PM
Paul,

Once again, thank you!

Yes, the button size = “large” works fine. I should have realized that by reading the code a little closer! Duh!

Thanks for the screentip & supertip example codes – I did not even know these existed.

Yes, the myimage & myImage were different as far as upper & lower case. I never thought to drop down the side list to recheck my work. Another Duh!

Also thanks for pointing out that I will need 2 sections in the Custom UI to use both 2007 and 2010. I will certainly keep this in mind as I work between 2007 and 2010.

So – saving it as a macro-enabled template (dotm) and putting into the start-up folder! Yep! That is the best solution (for me)! Thank you! Thank you! THANK YOU!

I do have 2 more questions if you can tolerate my ongoing ignorance.



1. If my macros do not have ActiveDocument or ThisDocument – then they won’t execute on the opened document? I thought just ticking the macro button meant it would invoke against the opened document -- ?



2. I saved your file (without the .zip) – and (forgive me) – but what are all those subfolders contained within it? I’m so new to this entire concept – I’m embarrassed.


Thanks again,
Janet

Paul_Hossler
11-28-2010, 06:21 PM
1. I think that by default the macro executes against the document that contains it for a lot of things, so if a macro in your template needs something from the template, you would need ThisDocument (=the template) and ActiveDocument for the user's

So if (for ex) you wanted to use a style from your template, THisDocument = your template, ActiveDocument = the one being worked with by the user


Sub MacroInTheTemplate()
MsgBox ActiveDocument.Name
MsgBox ThisDocument.Name
ActiveDocument.Styles("heading 1").Font = ThisDocument.Styles("normal").Font

End Sub


That's my understanding, anyway. I just do it like that from habit, and because that way I don't have to try and be clever. Some of the other forum member that are way more better than I am, could probalby get by without doing it that way.

2. A 2007/2010 office file is really a Zip file in disguise. By saving or renaming it to a a .ZIP extension, a zip-reading program can open it. The folders and files that you saw are all part of the format.

Experiment with an XLSX and XLSM file by renaming the .zip and you can see the innards. I don't know how all the _rels etc work.

3. As far as CustomUI and CustomUI14 sections are concerned, I believe that unless you're using some of the 2010 fluent features, you can use just the CustomUI part

Paul

Ice-Tea-Jan
11-29-2010, 08:44 PM
Paul,

Are you saying that if the add-in (global) macro needs something from the (directly attached) template then you should specify thisdocument to mean the directly attached template?

In your sample sub, you are saying that heading 1 in the directly attached template, should be “normal” in the active document?

Why are the messageboxes both in activedocument and thisdocument?

Should not the messagebox simply show anyway when you toggle the macro (add-in)?

Please help me understand this better. . .:hide:
Janet

Paul_Hossler
11-30-2010, 06:02 AM
Sorry I was not too clear

The ActiveDocument might not be the document that contrains the macro; that would be ThisDocument

See if this helps: replace your callback with the code below, and save the dotm as a Global Template in STARTUP

Click your buttons with and without an open document




Option Explicit
Const sModule As String = "Testing 1-2-3"
Sub myButtonMacro(control As IRibbonControl)
If Not ActiveDocument Is Nothing Then
Call MsgBox("The active document is " & ActiveDocument.Name, vbOKOnly, sModule & " -- " & control.ID)
Else
Call MsgBox("There is no document active right now", vbOKOnly, sModule & " -- " & control.ID)
End If

Call MsgBox("However, the Global Template that this macro is running in is called " & ThisDocument.Name, vbOKOnly, sModule & " -- " & control.ID)
End Sub


Paul

Ice-Tea-Jan
12-02-2010, 09:41 PM
Paul,


Thanks for crafting sample code to further explain this for me.

I do understand the active document is the opened document, and I do understand the macro is running in the Global template. I usually house all of my macros in the global templates (add-ins).

However, I'm still not sure I understand :doh:

As long as the global (add-in) template contains the VBA code “activedocument” they will run on the actual active (opened) document.
However, if I have a macro that is also stored within the active document’s directly attached template – the VBA code should contain "thisdocument”?I have a feeling I'm still missing something :(
Janet

Paul_Hossler
12-03-2010, 07:21 AM
1. Most times (at least in Word) ActiveDocumument is the one that I want the macro to 'act' on

2. I also store macros in an addin, along with style defintions, autotext, etc. that I want to always have available

3. If I need something (Style, Autotext, etc.) that's in the template with with the macro, then I need to use ThisDocument to point to the right document to get it from the add in, and not the ActiveDocument.

I might not be explaining this clearly, Gerry's a much better teacher that I

Paul

Ice-Tea-Jan
12-05-2010, 08:07 PM
Paul,

Thank you for all of your help and expertise.:hi:

I’m going to mark this thread solved because you certainly answered my original request, and imparted even more helpful information.

I’m going to post a separate question regarding the “thisdocument” versus “activedocument” since it is unfairly taking you off the subject of my original request; perhaps somebody else can help me with my brain freeeze on this issue.:doh:

I’ve also realized that I should have posted my original question in the “Office Ribbon Customization” section. I’m sure I saw that section some time ago, but did recognize what exactly it was until I had to start working with the ribbon myself.

Many thanks for your time. This forum is second to none! :thumb

Janet