'''Sub''' LoopTableExample '''Dim''' db As DAO.Database '''Dim''' rs As DAO.Recordset '''Set''' db = CurrentDb '''Set''' rs = db.OpenRecordset("SELECT * FROM tblMain") '''Do Until''' rs.EOF MsgBox rs!FieldName rs.MoveNext '''Loop''' rs.Close db.Close '''Set''' rs = '''Nothing''' '''Set''' db = '''Nothing''' '''End Sub'''
VBA ยังสามารถสร้างฟังก์ชันของผู้ใช้ (User Defined Function : UDF) ที่ใช้ในไมโครซอฟท์ เอกซ์เซล:
Public Function BUSINESSDAYPRIOR(dt As Date) As Date
Select Case Weekday(dt, vbMonday) Case 1 BUSINESSDAYPRIOR = dt -3 Case 7 BUSINESSDAYPRIOR = dt -2 Case Else BUSINESSDAYPRIOR = dt -1 End SelectEnd Function
ชวลเบส, กฟอร, แอปพล, เคช, นส, บทความน, ไม, การอ, างอ, งจากแหล, งท, มาใดกร, ณาช, วยปร, บปร, งบทความน, โดยเพ, มการอ, างอ, งแหล, งท, มาท, าเช, อถ, เน, อความท, ไม, แหล, งท, มาอาจถ, กค, ดค, านหร, อลบออก, เร, ยนร, าจะนำสารแม, แบบน, ออกได, อย, างไรและเม, อไร, เน, อหา. bthkhwamniimmikarxangxingcakaehlngthimaidkrunachwyprbprungbthkhwamni odyephimkarxangxingaehlngthimathinaechuxthux enuxkhwamthiimmiaehlngthimaxacthukkhdkhanhruxlbxxk eriynruwacanasaraemaebbnixxkidxyangiraelaemuxir enuxhainbthkhwamnilasmy oprdprbprungkhxmulihepniptamehtukarnpccubnhruxlasud duhnaxphiprayprakxbbthkhwamniekiywkbkarichphasawichwlebsikinopraekrmprayukt sahrbkhwamhmayxun duthi VBA aekkhwamkakwm wichwlebsikfxraexpphliekhchns Visual Basic for Applications VBA khuxkarichphasawichwlebsikinkarekhiynokhdkhwbkhumopraekrmprayuktxun echn imokhrsxfth xxffis xxotaekhd epntnVBA inimokhrsxfth exksesl 2007 khnaniimokhrsxfthxyuinrahwangkarepliyncakkarich VBA maich Visual Studio Tools for Applications VSTO sungichthanepndxtentefrmewirkaethn pccubnidepidihphuichthwipsamarthDownloadidodyrunlasudkhux VSTO 2005 SE Second Edition twxyang aekikhichphasa VBA inkareluxkkhxmulcaktaranginimokhrsxfth exksesl Sub LoopTableExample Dim db As DAO Database Dim rs As DAO Recordset Set db CurrentDb Set rs db OpenRecordset SELECT FROM tblMain Do Until rs EOF MsgBox rs FieldName rs MoveNext Loop rs Close db Close Set rs Nothing Set db Nothing End Sub VBA yngsamarthsrangfngkchnkhxngphuich User Defined Function UDF thiichinimokhrsxfth exksesl Public Function BUSINESSDAYPRIOR dt As Date As Date Select Case Weekday dt vbMonday Case 1 BUSINESSDAYPRIOR dt 3 Case 7 BUSINESSDAYPRIOR dt 2 Case Else BUSINESSDAYPRIOR dt 1 End Select End Functionduephim aekikhwichwlebsikaehlngkhxmulxun aekikhhnahlk VBA khxngewbimokhrsxfth hnahlk Visual Studio 2005 Tools for the Microsoft Office System khxngewbimokhrsxfth kradankhaw Utter Access ewbistokhd khxng James Igoe bthkhwamekiywkbsxftaewr hrux opraekrmkhxmphiwetxrniyngepnokhrng khunsamarthchwywikiphiediyidodyephimkhxmulekhathungcak https th wikipedia org w index php title wichwlebsikfxraexpphliekhchns amp oldid 9484970, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,