从功能区按钮打开用户窗体 [英] Open UserForm from Ribbon Button

查看:204
本文介绍了从功能区按钮打开用户窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我创建了一个带有多个自定义按钮的自定义功能区。

I have created a custom Ribbon with several custom buttons.

如何在打开用户表单时单击功能区上的按钮?

How can I open a user form when a button on the Ribbon is clicked?

具体应该按钮的OnAction =?

Specifically what should the button's OnAction = ?

谢谢,

M.威尔逊

M. Wilson

M. Wilson

推荐答案

在标准模块中创建如下的子。

Create a sub like the following in a standard module.

Sub OpenForm( )

    UserForm1.Show

End Sub

Sub OpenForm()
    UserForm1.Show
End Sub

然后按钮的OnAction =" OpenForm"

Then the button's OnAction = "OpenForm"

如果工作簿尚未打开,请尝试以下操作:

If the workbook is not already open then try following:

OnAction ="'C:\Users \ 用户名 \Documents\Excel \Test Macros \但要打开用户形式'!OpenForm"

OnAction = "'C:\Users\UserName\Documents\Excel\Test Macros\Button to open userform'!OpenForm"

请注意,路径和文件名用单引号括起来,然后是整个路径和工作簿名称用双引号括起来。

Note that the path and filename is enclosed in single quotes and then the entire path and workbook name enclosed in double quotes.


这篇关于从功能区按钮打开用户窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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