该楼层疑似违规已被系统折叠隐藏此楼查看此楼
Name:=UserName
DocName:="TravelRequestfor"+Name+","+GetDate()
DocSumSet(DescriptiveType!;"TravelRequest")
DocSumSet(DescriptiveName!;DocName)
DocSumSet(Author!;Name)
Thisfragmentofcodegetstheusersname(assetupin"Edit","Preferences","Environment"foreachuser),putsitandthecurrentdateintotheDocNamevariable,setsthedocumentsummary"type"fieldto"TravelRequest"asadocumenttype,entersthedocumentnameintothetitlefield(DescriptiveName!)ofthedocumentsummary,andalsosetstheusersnameinthesummaryinfo.TheDocNameandNamevariablesarealsoavailabletobeputintothedocumentitself,ifdesired,byusingtheType()macrofunction.IdothisoneverytemplateIcreate,sothetitlesareautomaticallyavailableinthefiledialogwithoutanyeffortonthepartoftheuser.
AnotherreasonIusemacrosinsteadofthepromptbuilderistoprovidemorespecificfieldtypesforthedatatheuseristoenter.Thepromptbuildermakesallfieldsgenerictextfields.ByusingtheDialogEditorforamacro,youcandefinenotonlyamorelogicalgroupingofthefields(differentsizes,shapes,locations),butyoucanusespecialpurposefields,suchasadatefieldorfilenamefield.Adatefieldprovidesapop-upcalendarthattheusercanmoreeasilyusetoenteradate;amonthlycalendarpopsup,andtheuserjustclicksonthedatedesired(differentmonthsandyearscanbeselectedwithbuttonsonthecalendarview).Yourmacrogetsbackadatestringthatisalreadyerror-checked,sinceitmusthavebeenavaliddatewhenchosenfromacalendar.Similarly,ifyouwanttheusertoenterafilenameordirectorythatalreadyexists,thefilecontrolprovidesapop-updialogforselectingthefile,justlikethedialogtheusergetswhenopeningafileforWPWin.Again,itiseasierfortheusertoselectthefilenamefromthedialog,andthedataisusuallyalreadycorrect(thefileordirectoryexists)sinceitisselecteddirectlyfromtheusersdiskornetworkvolume.Youcanalsocontroluserselectionswithradiobuttons,checkboxes,drop-downlistsorlistboxes,etc.Ifyouwanttomakesuretheuserentersonlyoneofaparticularlistoftextstrings,youcanuseadrop-downlistandpre-definewhatgoesintothelist.Thesenotonlysimplifytheusersselections,sincethepossiblechoicesarespecificallylisted,butitensuresthatonlyvalidoptionsareselectedforyourdocumentorform.
Templatevs.FileMacros--Whichtouse?
WhenusedwithcorporateLAN-basedtemplates,Iselectthetypeofmacrobasedonhowitwillbeused,dependingmostlyonmaintenanceissues.Ifthemacroisgeneralpurpose,usableformorethanonetemplate(thetypeIusuallytrytowrite),thechoiceisobvious--makeitfile-basedsoyoucanhaveonecopyinthecentralmacrodirectory,andanyupdateswillcorrectalltemplateswithonemacrofilechange.
Ifthemacroissmallandisapplicableonlytoasingletemplate,andthetemplateisnotusedfrequently,keepingthemacroasatemplatemacromakessensesinceitiskeptwiththetemplateinonefile.Also,ifthetemplateisonethatusersarelikelytotakehomewiththemtouse,keepingmacroswiththetemplatemakesiteasierfortheuser--onlyonefilehasbetocopiedtothehomePC,andupdatestothemacro(s)arekeptinsyncwiththetemplate(updatingtheuserstemplatealsokeepsthecorrespondingversionsofthemacroswithit).
However,beawarethatonacentralLAN-basedsystem,alluserswhohaveusedaparticulartemplatemustexitfromWPWinbeforethattemplateinthecommonLANdirectorycanbeupdated.Otherwise,afilesharingerrorwillbeencountered("fileinuse"typenetworkerror)whiletryingtooverwritethetemplatefilewithanupdate.Thiscanbeparticularlyannoyingwithtemplatesthatarefrequentlyused--itisdifficulttogeteveryoneoutofWPatthesametimeinordertodotheupdate.Thiscanmeanafter-hoursefforts.Forthisreason,manymacrosthatmightbeupdatedperiodicallywouldbenefitfrombeingmaintainedasafilemacro,soyoucanupdatethemacrowithouthavingtocoordinateupdatesofthetemplate.Macrosarenotkeptopenaslongastemplates,sincethetemplateiskeptopenaslongastheuserisworkingonadocumentbasedonthattemplate.Also,ithasbeenmyexperiencethatnotonlymusttheuserexitthetemplatedocument,butacompleteexitfromWPWinisneededbeforethetemplatecanbeupdated.
英语阅读理解关于计算机 一篇摘选的关于计算机的英语阅读材料 对大家的英语也许会有提高!...