Click here to Skip to main content
14,601,227 members
Rate this:
Please Sign up or sign in to vote.
See more:
Here i written code for create custom tab in my outlook 2007.But its raising error like object is required.please help me to a solution.My code is given below.

Sub AddCustomUI()
    Dim customUiXml As String

    customUiXml = "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2006/01/customui"">" _
        & "<mso:ribbon><mso:tabs><mso:tab id=""myTab"" label=""New Tab"" " _
        & "insertBeforeQ=""mso:TabView"">" _
        & "<mso:group id=""group1"" label=""New Group"">" _
        & "<mso:button id=""button1"" label=""Test Button"" size=""large"" " _
        & "imageMso=""GetExternalDataFromText"" />" _
        & "</mso:group></mso:tab></mso:tabs></mso:ribbon></mso:customUI>"

    ActiveProject.SetCustomUI (customUiXml)//getting errorhere like object is required.
    End Sub


and tell me if there is another way to create custom tab in outlook 2007 with vba application.
Posted
Updated 2-Jun-17 11:00am
v2
Comments
Richard MacCutchan 1-Oct-15 4:41am
   
What error, where does it occur?
Maciej Los 1-Oct-15 4:49am
   
Do not post the same question again and again!
Member 11944583 7-Oct-15 2:54am
   
object is required is the error message.I have mentioned in my code part also.see it please.
Member 11944583 7-Oct-15 2:56am
   
but i didnt get any perfect answer for any of my question thats why i have posted it again and again.
Richard MacCutchan 7-Oct-15 6:46am
   
Then add the required object to your code.

And please post the exact and complete text of the error message. Copying and pasting such information will help you get an answer much more quickly.
Rate this:
Please Sign up or sign in to vote.

Solution 1

You can't add custom controls on MS Outlook ribbon via VBA! See my past answer[^].

You have to write COM Addin. Please refer this: Extending the User Interface in Outlook 2010[^]
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

Actually, you CAN add a custom control using VBA by editing the officeUI customization file as Outlook is started up.

Here is a sample solution...

experts-exchange solution: HOW-TO-Manipulating-Office-Ribbon-Bar-only-with-VBA

It is not perfect, as some error checking or checking to see if the custom tab, group and / or button already exists before trying to add it in again. Also, it seems that the code presented here doesn't quite handle the situation where there have been no customizations to the ribbon already made... at least in Outlook 2010.

Also, using similar methods of editing the same file, you can add custom buttons to the QAT (Quick Access Toolbar).

.
   
Comments
CHill60 2-Jun-17 18:01pm
   
I think the repeated references to "You have to close and reopen your office application to see it." is enough to push me towards doing it properly with an Add-In
Pat O'Brien 5-Jun-17 7:02am
   
Then I guess that you didn't read the whole post. You DO NOT have to close and reopen the office application to see it. In fact, it can be done outside of the application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100