资源描述:
《翻译英文 文档》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、VisualBasicforApplications(VBA)isanimplementationofMicrosoft'sevent-drivenprogramminglanguageVisualBasic6,andassociatedintegrateddevelopmentenvironment(IDE),whichisbuiltintomostMicrosoftOfficeapplications.VBAenablesdeveloperstobuilduserdefinedfunctions,automateproc
2、esses,andaccessWin32andotherlowlevelfunctionalitythroughDLLs.ItwasalsobuiltintoOfficeapplicationsuptoversion2004forApple'sMacOSX,otherMicrosoftapplicationssuchasMicrosoftMapPointandMicrosoftVisio;aswellasbeingatleastpartiallyimplementedinsomeotherapplicationssuchas
3、AutoCAD,WordPerfectandArcGIS.Itsupersedesandexpandsonthecapabilitiesofearlierapplication-specificmacroprogramminglanguagessuchasWord'sWordBasic,andcanbeusedtocontrolmanyaspectsofthehostapplication,includingmanipulatinguserinterfacefeatures,suchasmenusandtoolbars,an
4、dworkingwithcustomuserformsordialogboxes.VBAcanalsobeusedtocreateimportandexportfiltersforvariousfileformats,suchasODF.Asitsnamesuggests,VBAiscloselyrelatedtoVisualBasicandusestheVisualBasicRuntime,butcannormallyonlyruncodewithinahostapplicationratherthanasastandal
5、oneapplication.Itcan,however,beusedtocontroloneapplicationfromanotherusingOLEAutomation.Forexample,itisusedtoautomaticallycreateaWordreportfromExceldata,inturnautomaticallycollectedbyExcelfrompolledobservationsensors.VBAisfunctionallyrichandflexiblebutitdoeshavesom
6、eimportantlimitations,suchasrestrictedsupportforfunctionpointerswhichareusedascallbackfunctionsintheWindowsAPI.Ithastheabilitytouse(butnotcreate)(ActiveX/COM)DLLs,andlaterversionsaddsupportforclassmodules.LanguageCodewritteninVBAiscompiled[1]toaproprietaryintermedi
7、atelanguagecalledP-code(packedcode)[2],whichisstoredbythehostingapplications(Access,Excel,Word,PowerPoint))asaseparatestreaminStructuredstoragefiles(e.g.,.docor.xls)independentofthedocumentstreams.Theintermediatecodeisthenexecuted[1]byavirtualmachine(hostedbythehos
8、tingapplication).DespiteitsresemblancetomanyoldBASICdialects(particularlyMicrosoftBASIC,fromwhichitisindirectlyderived),VBAisnotcompatiblewithany