信息时代的管理信息系统Module-M课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《信息时代的管理信息系统Module-M课件.ppt》由用户(三亚风情)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 信息时代 管理信息系统 Module_M 课件
- 资源描述:
-
1、Extended Learning Module MProgramming in Excel with VBAINTRODUCTIONVBA,which stands for Visual Basic for Applications,is a programming language developed by MicrosoftExcel,along with the other members of Microsoft Office,includes the VBA language INTRODUCTIONExcel VBA is a programming application th
2、at allows Visual Basic code to customize your Excel applicationsUnits of VBA code are often referred to as macros INTRODUCTIONOne advantage of Excel VBA is the macro recorderThe macro recorder is a software tool that will let you record a sequence of commands in Excel and save them as a macro WHY VB
3、A?VBA is a programming language,but it also serves as a macro languageA macro language is a programming language that includes built-in commands that mimic the functionality available from menus and dialog boxes within an applicationA macro is a set of actions recorded or written by a user WHY VBA?C
4、reate a VBA macro to format and print a month-end sales reportExecute the macro with a single commandTrigger Excel to automatically perform many time-consuming tasks WHY VBA?If you are able to perform an operation manually,you can use the macro recorder to capture that operationYou can use VBA to cr
5、eate your own worksheet functions WHY VBA?Common uses for VBA macros:Inserting text Automating a task Automating repetitive tasksCreating a custom command WHY VBA?Common uses for VBA macros:Creating a custom toolbar buttonCreating a custom menu command Creating a simplified front endDeveloping new w
6、orksheet functions Creating complete,macro-driven applications VBA in a NutshellYou perform actions in VBA by writing(or recording)code in a VBA macroYou view and edit VBA macros using the Visual Basic Editor(VBE)VBA in a NutshellA VBA macro consists of Sub proceduresA Sub procedure is computer code
7、 that performs some action on or with objects VBA in a NutshellSub procedure example:Sub Demo()Sum=1+1MsgBox“The answer is”&Sum End Sub VBA in a NutshellA VBA macro can also have Function proceduresA Function procedure is a VBA macro that returns a single valueYou can call it from another VBA macro
8、or even use it as a function in a worksheet formula VBA in a NutshellFunction example:Function AddTwo(arg1,arg2)AddTwo=arg1+arg2 End Function VBA in a NutshellVBA manipulates objectsAn object in VBA is an item available for you to control in your codeExcel provides more than 100 objects that you can
9、 manipulate VBA in a NutshellYou can assign values to variablesA variable is a place to store a piece of informationYou can use variables in your VBA macro to store such things as values,text,or property settings VBA in a NutshellVBA FUNCTIONEXAMPLEObjectArranged in a hierarchyExcel:Workbook:Workshe
10、etApplication.Workbooks(“Book1.xls”).Worksheets(“Sheet1”)MethodsMethod is an action such as ClearContentsWorksheets(“Sheet1”).Range(“A1”).ClearContentsTHE VISUAL BASIC EDITORThe Visual Basic Editor(VBE)is a separate application where you write and edit your Visual Basic macrosYou cant run the VBE se
11、parately;Excel must be running in order for the VBE to operate THE VISUAL BASIC EDITORThe quickest way to activate the VBE is to press Alt+F11 when Excel is activeTo return to Excel,press Alt+F11 againAlt+F11 acts as a toggle between the Excel application interface and the VBE You can also activate
12、the VBE by using the menus within ExcelChoose Tools,then Macro,and then choose Visual Basic Editor The VBE ToolsMenu BarToolbarProject Explorer WindowCode WindowThe Properties WindowThe Immediate Window The VBE ToolsWorking with the Project ExplorerWhen working in the VBE,each Excel workbook thats o
13、pen is a projectA project is a collection of objects arranged as an outlineExpand a project by clicking the plus sign(+)To contract a project click the minus sign(-)Adding a New VBA ModuleFollow these steps to add a new VBA module to a project:1.Create a new workbook in Excel2.Press Alt+F11 to activ
14、ate the VBE3.Select the projects name in the Project Explorer window4.Choose Insert and then Module or you can use the shortcut,by using the right-mouse click,choosing Insert,and then Module Removing a VBA ModuleTo remove a VBA module from a project,follow these steps:1.Select the modules name in th
15、e Project Explorer window2.Choose File,and then Remove ModuleName Creating a ModuleIn general,a VBA module can hold several types of code:Sub procedures-A set of programming instructions that performs some action Function procedures-A set of programming instructions that returns a single valueDeclar
16、ations-One or more information statements that you provide to VBA VBA Module CodeBefore you can do anything meaningful,you must have some VBA code in the VBA moduleYou can get VBA code into a VBA macro in two ways:1.Entering the code directly by typing it2.Using the Excel macro recorder to record yo
17、ur actions and convert them to VBA code Entering Code DirectlyYou can type code directly into the moduleYou can select,copy,cut,paste,and do other things to the textWhen you are entering your code directly,you use the Tab key to indent some of the lines to make your code easier to read Entering Code
18、 DirectlyEntering Code DirectlyUsing the Macro Recorder1.Activate a worksheet in the workbook2.Choose Tools,then Macro,and then Record New Macro3.Excel displays its Record Macro dialog box4.Click OK to accept the defaults5.Excel automatically inserts a new VBA module into the project6.From this poin
19、t on,Excel converts your actions into VBA code-while recording,Excel displays the word Recording in the status bar Using the Macro Recorder7.Excel displays a miniature floating toolbar that con-tains two toolbar buttons:Stop Recording and Relative Reference 8.Choose Tools,then Options9.Click the Vie
展开阅读全文