[ Pobierz całość w formacie PDF ]
.Print  OK was pressedElseDebug.Print  Cancel was pressedEnd IfEnd Sub182 / Chapter 8 Name InstructionSyntax Name OldName$ As NewName$Description Renames file OldName$ as NewName$.Parameter DescriptionOldName$ This string value is the path and name of the file.A path relativeto the current directory can be used.NewName$ This is the new filename.The file remains in its original directory.Example Sub MainName  AUTOEXEC.BAK As  AUTOEXEC.SAVEnd SubNothing KeywordDescription An objexpr that does not refer to any object.Now FunctionSyntax NowDescription Returns the current date and time as a date value.See also Date, Time, TimerExample Sub MainDebug.Print Date  example: 1-1-1996 10:0532 AMEnd SubNull KeywordDescription A variant expression that is null.A Null value propagates through anexpression, causing the entire expression to be null.Attempting to use aNull value as a string or numeric argument causes a runtime error.ANull value prints as  #NULL#.Language Reference / 183 Example Sub MainX = NullDebug.Print X = Null  #NULL#Debug.Print IsNull(X)  TrueEnd SubObject Data TypeDescription An object reference value.Object ModuleDescription Implements an OLE Automation object.An object module has a set ofPublic properties, functions, and subroutines that are accessible fromother macros and modules.These public symbols are accessed using thename of the object module or of an object variable.Public Consts, Types, arrays, and fixed-length strings are not allowed.An object module is similar to a class module except that one instance ofan object module is automatically created.That instance has the samename as the object module s name.To create additional instances use:Dim Obj As objectnameSet Obj = New objectnameSee also Class Module, Code Module, UsesExample  A.WWB #Uses  System.OBMSub MainDebug.Print Hex(System.Version)End Sub System.OBMOption ExplicitDeclare Function GetVersion16 Lib  Kernel _Alias  GetVersion () As LongDeclare Function GetVersion32 Lib  Kernel32" _184 / Chapter 8 Alias  GetVersion" () As LongPublic Function Version() As LongIf Win16 ThenVersion = GetVersion16ElseVersion = GetVersion32End IfEnd FunctionObject_Initialize SubSyntax Private Sub Object_Initialize().End SubDescription Object-module initialization subroutine.Each time a new instance iscreated for an object module, the Object_Initialize subroutine is called.IfObject_Initialize is not defined, no special initialization occurs.Note: Object_Initialize is also called for the instance that is automaticallycreated.See also Object Module, Object_TerminateObject_Terminate SubSyntax Private Sub Object_Terminate().End SubDescription Object-module-termination subroutine.Each time an instance isdestroyed for an object module, the Object_Terminate sub is called.IfObject_Terminate is not defined, no special termination occurs.See also Object Module, Object_InitializeLanguage Reference / 185 Oct$ FunctionSyntax Oct [$] (Num)Description Returns an octal string.Parameter DescriptionNum Returns an octal-encoded string for this number value.See also Hex$( ), Str$( ), Val( )Example Sub MainDebug.Print Oct$(15)  17End SubOKButton Dialog Item DefinitionSyntax OKButton X, Y, DX, DY[,.Field]Description Defines an OK button item.Pressing the OK button updates the dlgvarfiled values and closes the dialog.(Dialog( ) function call returns -1.)Parameter DescriptionX This number value is the distance from the left edge of the dialogbox, measured in 1/8ths of the average character width for thedialog s font.Y This number value is the distance from the top edge of the dialogbox.It is measured in 1/12ths of the character height for thedialog s font.DX This number value is the width, measured in 1/8ths of theaverage character width for the dialog s font.DY This number value is the height, measured in 1/12ths of thecharacter height for the dialog s font.Field This identifier is the name of the field.The dialogfunc receivesthis name as string.If this is omitted, the field name is  OK.See also Begin Dialog, Dim As UserDialogExample Sub MainBegin Dialog UserDialog 200,120Text 10,10,180,30,"Please push the OK button"OKButton 80,90,40,20186 / Chapter 8 End DialogDim dlg As UserDialogDialog dlg  show dialog (wait for OK)End SubOn Error InstructionSyntax On Error GoTo 0-or-On Error GoTo label-or-On Error Resume NextDescription Form 1: Disables the error handler (default).Form 2: Sends error conditions to an error handler.Form 3: Continues execution at the next statement.On Error sets or disables the error handler.Each user-defined subroutine,function, or property has its own error handler.The default is toterminate the macro on any error.The Err s object properties are setwhenever an error occurs.After an error has occurred and the errorhandler is executing, any additional errors will terminate the macro,unless the Err object has been cleared.Note: This instruction clears the Err and sets Error$ to null.Example Sub MainOn Error Resume NextErr.Raise 1Debug.Print  RESUMING, Err= ;ErrOn Error GoTo XErr.Raise 1Exit SubX: Debug.Print  Err= ;ErrErr = ClearDebug [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • necian.htw.pl