简体   繁体   English

将表单嵌入到Excel VBA中的“多页”选项卡中

[英]Embedding a form into a MultiPage tab in Excel VBA

I am using Excel 2010. I have already created and tested 2 complex forms frmA and frmB . 我使用Excel 2010中我已经创建并测试2种复杂的形式frmAfrmB They run and then save data to the workbook when user hits Apply or OK . 他们运行,然后在用户单击ApplyOK时将数据保存到工作簿。 Now my user wants frmA to be able to call frmB , do some work, then return to frmA . 现在,我的用户想要frmA到能够调用frmB ,做一些工作,然后返回到frmA I thought it might look professional if they could be on a MultiPage , but I don't want to rebuild and retest these forms. 我认为,如果它们可以在MultiPage上看起来可能很专业,但是我不想重建和重新测试这些表单。

Is there anyway I can create a 2-tab MultiPage form and then make frmA appear on the first tab, frmB appear on the second? 反正我有可以创建2标签MultiPage表格,然后进行frmA出现在第一个选项卡上, frmB出现在第二? Then I can simply handle the communication between the two instead of recoding. 然后,我可以简单地处理两者之间的通信,而无需重新编码。

Or maybe I can just paste all the objects and code from each form onto the tabs and do some object renaming. 或者,也许我可以将所有表单中的所有对象和代码粘贴到选项卡上,并进行一些对象重命名。 The retesting will be extensive, though. 不过,重新测试将是广泛的。

If not, I will have to do frmA.show , (user clicks Open frmB button), frmA.Hide , frmB.Initialize , frmB.Show , (do some work, hit Apply / OK / Cancel ), (update spreadsheet with changes), frmB.Hide / Unload , ( frmA.Initialize due to changes), frmA.Show . 如果没有,我会做frmA.show ,(用户点击打开frmB按钮), frmA.HidefrmB.InitializefrmB.Show ,(做了一些工作,打到应用 / 确定 / 取消 ),(有改动更新电子表格), frmB.Hide / Unload ,( frmA.Initialize由于更改), frmA.Show I have not gotten this to work properly yet – frmA disappears and doesn't come back, but I will work on it if the MultiPage is not possible. 我还没有得到这正常工作尚未- frmA消失和不回来,但我会在这工作,如果MultiPage是不可能的。

Maybe you can save me time by pointing me in the right direction. 也许您可以通过指示正确的方向来节省我的时间。

I am accepting @guitarthrower 's answer: To answer your question, no you cannot embed one userform in another using Excel VBA. 我接受@guitarthrower的回答:要回答您的问题,不,您不能使用Excel VBA将一个用户窗体嵌入另一个用户窗体。 – guitarthrower –吉他弹奏者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM