



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
e800,国内最具活力的IT门户网站。【e800编译】此示例说明了在Microsoft Excel 2010工作簿中如何处理各种UI的性能。此代码段是Office 2010的101项VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。每块示例代码包含约5至50行的代码,分别演示了一个独特的功能或功能集,在VBA或VB以及C中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。Microsoft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visual Basic Application(VBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。实例代码在Excel 2010中新建工作簿,复制这些代码到Sheet1类模块。将光标置于TestApplicationProperties中,然后按F8单步执行代码。如果将并列放置VBA和Excel窗口,效果会更加明显。Sub TestApplicationProperties()Dim saveDisplayFormulaAutoComplete As BooleanDim saveShowDevTools As BooleanDim saveShowMenuFloaties As BooleanDim saveShowSelectionFloaties As BooleanDim saveDisplayDocumentInformationPanel As BooleanDim saveEnableLivePreview As BooleanDim saveFormulaBarHeight As IntegerWith Application Preserve the current state of things, so the code can put them back when done.saveDisplayFormulaAutoComplete = .DisplayFormulaAutoCompletesaveShowDevTools = .ShowDevToolssaveShowMenuFloaties = .ShowMenuFloatiessaveShowSelectionFloaties = .ShowMenuFloatiessaveDisplayDocumentInformationPanel = .DisplayDocumentInformationPanelsaveEnableLivePreview = .EnableLivePreviewsaveWarnOnFunctionNameConflict = .WarnOnFunctionNameConflictsaveFormulaBarHeight = .FormulaBarHeight Try out the various features added in Excel 2007:.DisplayFormulaAutoComplete = True In Excel, select cell A1, and then in the formula bar, start entering a formula like =RandBetween(1, 100), and watch the help you get in a formula drop-down list as you type. Execute the next line of code, and repeat the test: This time you wont see the dropdown:.DisplayFormulaAutoComplete = False.ShowDevTools = True In Excel, note that the Development Ribbon item now is visible. Execute the next line, and note that its now hidden:.ShowDevTools = False.ShowMenuFloaties = False In Excel, right-click in a cell. Note the floatie menu that appears. Execute the next line, and verify that you no longer see that menu when you right-click. Note that the boolean value is the opposite of what you would expect. If the ShowMenuFloaties property is True, the floaties DO NOT appear; if False, they do.ShowMenuFloaties = True.ShowSelectionFloaties = False Enter text into a cell, and then select a few characters. You see a floatie menu with formatting options. Then execute the next line, and verify that the same actions do not display the floatie menu. Note that the boolean value is the opposite of what you would expect. If the ShowSelectionFloaties property is True, the floaties DO NOT appear; if False, they do.ShowSelectionFloaties = True.DisplayDocumentInformationPanel = True After executing the previous line of code, you see the document information panel. Execute the next line to hide this panel:.DisplayDocumentInformationPanel = False.EnableLivePreview = False After executing the previous line of code, enter some text into a cell, and select a font. As you scroll through the font list, the formatting wont update as you select fonts. When you select a font and dismiss the menu, the font will change in the cell. Execute the following line, and try again-now the font updates as you scroll through the font menu. The same concept applies to all other formatting changes.EnableLivePreview = True.FormulaBarHeight = 2 After executing the previous line of code, the formula bar height should be changed. Execute the following line to set it to 1, the default height.FormulaBarHeight = 1 Put things back the way they were originally.DisplayFormulaAutoComplete = saveDisplayFormulaAutoComplete.ShowDevTools = saveShowDevTools.ShowMenuFloaties = saveShowMenuFloaties.ShowMenuFloaties =
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025租赁合同违约金责任认定
- 2025年拆迁安置房买卖合同的法律效力如何
- 2025《合同法学》学习指南与实务作业
- 第4课《灯笼》说课稿 2025-2026学年统编版语文八年级下册
- 3.1 质量与密度 说课稿 -2024-2025学年浙教版科学七年级下册
- 八年级语文上册 第四单元 16《散文二篇》说课稿 新人教版五四制
- 2024-2025学年高中语文 第1单元 向青春举杯(活动体验)单元序列写作(一)激活我们的诗情说课稿 苏教版必修1
- 浙教版七年级科学下册说课稿:4.4月相
- 机械厂噪声投诉处理办法
- 双鸭山事业单位笔试真题2025
- 信息安全管理制度
- 社交心理在网络营销中的实战运用
- 2025年少先队应知应会知识考试题库
- 2025年宁波农商发展集团限公司招聘高频重点提升(共500题)附带答案详解
- 蜀道集团招聘笔试
- 历年全国普通话考试真题50套
- 2024年社区警务规范考试题库
- 农业测绘技术服务方案
- 2025年上海市高考语文专项复习:识记背诵默写
- 2024年中级经济师(金融)《专业知识与实务》考前必刷必练题库500题(含真题、必会题)
- TGXAS-松阔混交林培育技术规程编制说明
评论
0/150
提交评论