需要像对象一样的vba代码错误问题。 [英] Issue on vba code error like object is required.

查看:86
本文介绍了需要像对象一样的vba代码错误问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我在outlook 2007中编写了创建自定义选项卡的代码。但是它需要像对象那样引发错误。请帮我解决。我的代码如下。



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





并告诉我是否有另一种方法在Outlook 2007中使用vba应用程序创建自定义选项卡。



and tell me if there is another way to create custom tab in outlook 2007 with vba application.

推荐答案

你不能通过VBA在MS Outlook功能区上添加自定义控件!请参阅我的过去的答案 [ ^ ]。



你必须写COM Addin。请参考:在Outlook 2010中扩展用户界面 [ ^ ]
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[^]


实际上,您可以通过在Outlook启动时编辑officeUI自定义文件来使用VBA添加自定义控件。



这是一个示例解决方案...



专家交换解决方案:HOW-TO-Manipulating-Office-Ribbon-Bar-only-with-VBA



这不是完美的,因为在尝试再次添加自定义选项卡,组和/或按钮之前,一些错误检查或检查以查看自定义选项卡,组和/或按钮是否已存在。此外,似乎这里提供的代码并不能完全处理已经制作的功能区没有自定义的情况......至少在Outlook 2010中。



此外,使用类似的编辑同一文件的方法,您可以向QAT(快速访问工具栏)添加自定义按钮。



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).

.


这篇关于需要像对象一样的vba代码错误问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆