????? ????? ??? ?? Visual Basic ????????? ?? Excel ?? Mac

?????? ????????? ?????? ?????????
???? ???????: 193247 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

??? ???? ??? ??? ??????? ?? Microsoft Visual Basic for Applications ????? ? ???? ????? ??? ??? ?????? ??? ??????? ???? ??????? ?? ???? unpredictably.

???? ??????? ?? ???? ?? ???? unpredictably ????? ????? ????????? ???????? ??????? ???? ????? ????? ??????? ?????? ????? ?????? ????. ???? ????? ??????? ? ?????? ??? ??? ??????? "?????? ???". ???? ?????? ????????? ????? ??????? ????? ?????? ????? "????? ?????? ???????" ?? "????? ???????."

??????? ????

???? Microsoft ??????? ???????? ??? ??? ?? ???? ??????? ?? ?? ?????. ??? ????? ???? ?? ????? ??? ???????? ??????? ?????? ???????? ?? ???????? ???? ????. ????? ??? ??????? ???? ?????? ?? ??? ??????? ???? ??? ????? ?? ??????? ???? ??? ????????? ?????? ?????? ?????????. ???? ??????? ????? ??? Microsoft ??? ????? ????? ???? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ??????? ?????. ?? ????? ??? ????? ?? ??????? ???? ???? trapped ????? ????? ????????? ???????? ?? Visual Basic. ????? ????????? ?? ????? ????? ??? ?? Microsoft Excel ?? Mac ???????? ??????? ??????? ???????.

??? ???? ?????

???? ??????? ??? ?? Visual Basic for Applications ?????? ?? ????? ????? ????? ???. ??? ???? ?????? ??? ??? ????? ?????? ?? ?????? ????? ?? ???? ?????? ?? ???.

err ????

????? ???? Err ??? ??? ?????? ???.

??????? ???? Err ??????:
   Msgbox "The most recent error number is " & Err & _
      ". Its message text is: " & Error(Err)
				
?????? ?????? ????? ??? ????? ???? ??? ???? ????? ???? ?? ??????? ??? ??????? ???? Err.
   Error code   Error message
   ----------   -------------
   3            Return without GoSub
   5            Invalid procedure call
   6            Overflow
   7            Out of memory
   9            Subscript out of range
   10           This array is fixed or temporarily locked
   11           Division by zero
   13           Type mismatch
   14           Out of string space
   16           Expression too complex
   17           Can't perform requested operation
   18           User interrupt occurred
   20           Resume without error
   28           Out of stack space
   35           Sub, function, or property not defined
   47           Too many DLL application clients
   48           Error in loading DLL
   49           Bad DLL calling convention
   51           Internal error
   52           Bad file name or number
   53           File not found
   54           Bad file mode
   55           File already open
   57           Device I/O error
   58           File already exists
   59           Bad record length
   61           Disk full
   62           Input past end of line
   63           Bad record number
   67           Too many files
   68           Device unavailable
   70           Permission denied
   71           Disk not ready
   74           Can't rename with different drive
   75           Path/File access error
   76           Path not found
   91           Object variable or With block variable not set
   92           For Loop not initialized
   93           Invalid pattern string
   94           Invalid use of Null
   298          System DLL could not be loaded
   320          Can't use character device names in specified file names
   321          Invalid file format
   322          Can't create necessary temporary file
   325          Invalid format in resource file
   327          Data value named was not found
   328          Illegal parameter; can't write arrays
   335          Could not access system registry
   336          ActiveX component not correctly registered
   337          ActiveX component not found
   338          ActiveX component did not correctly run
   360          Object already loaded
   361          Can't load or unload this object
   363          Specified ActiveX control not found
   364          Object was unloaded
   365          Unable to unload within this context
   368          The specified file is out of date. This program requires
                a newer version
   371          The specified object can't be used as an owner form for
                Show
   380          Invalid property value
   381          Invalid property-array index
   382          Property Set can't be executed at run time
   383          Property Set can't be used with a read-only property
   385          Need property-array index
   387          Property Set not permitted
   393          Property Get can't be executed at run time
   394          Property Get can't be executed on write-only property
   400          Form already displayed; can't show modally
   402          Code must close topmost modal form first
   419          Permission to use object denied
   422          Property not found
   423          Property or method not found
   424          Object required
   425          Invalid object use
   429          ActiveX component can't create object or return
                reference to this object
   430          Class doesn't support OLE Automation
   430          Class doesn't support Automation
   432          File name or class name not found during Automation
                operation
   438          Object doesn't support this property or method
   440          OLE Automation error
   440          Automation error
   442          Connection to type library or object library for remote
                process has been lost
   443          Automation object doesn't have a default value
   445          Object doesn't support this action
   446          Object doesn't support named arguments
   447          Object doesn't support current locale settings
   448          Named argument not found
   449          Argument not optional or invalid property assignment
   450          Wrong number of arguments or invalid property assignment
   451          Object not a collection
   452          Invalid ordinal
   453          Specified DLL function not found
   454          Code resource not found
   455          Code resource lock error
   457          This key is already associated with an element of this
                collection
   458          Variable uses a type not supported in Visual Basic
   459          This component doesn't support events
   460          Invalid Cipboard format
   461          Specified format doesn't match format of data
   480          Can't create AutoRedraw image
   481          Invalid picture
   482          Printer error
   483          Printer driver does not support specified property
   484          Problem getting printer information from the system.
                Make sure the printer is set up correctly
   485          Invalid picture type
   486          Can't print form image to this type of printer
   735          Can't save file to Temp directory
   744          Search text not found
   746          Replacements too long
   31001        Out of memory
   31004        No object
   31018        Class is not set
   31027        Unable to activate object
   31032        Unable to create embedded object
   31036        Error saving to file
   31037        Error loading from file
				

???? ?????

????? ???? ????? ????? ????? ???? ?????? ?? ??? ??? ????.

??????? ???? ????? ??????:
   Msgbox "The message text of the error is: " & Error(Err)
				

???? ???

????? ????? ??? ????? ??? ?? ???? ?????? ?? ????? ??? ??? ????? ?????? Err. ??? ???????? - ????? ??? ????? ?? ????? ???? ???? ????? ????????? ?????? ?? ???????? ???? ??? ????? ?? ??????? ??? ???????? Variant. ??? ??????? ????? ?? ??? ????? ?? ???? ????? ????????? ???? ???? ??? ????? ????? ????. ??? ???? ??????? ????? ?? ???? ??????? ????? ??? ??? ???? ??????? ??? ??? ???? ????. ??????? ????? ?? ???? ?????? ???????? ???? ?????? ???????? ?? ??? ?? ??? ??? ???????? ?? ?????? ??????? ????? ??? ??????? ??????? ???? ????? ????????.

????? ??? ???? ?? ??? ???????? Variant ? ??? ??????? ??????? "??? ????" ???? ?? ???? ?? ????? ?? ??? Variant ??? ???? ????? ??? ???? ???? ????? ????? Visual Basic for Applications ?? ??? ????? ?? ??? ????????. ??? ??????? ??? ??? ?? ????? ???? ??? ???? ??? ??????. ?? ????? ??? ??????? ????? ????? ??? ??????? ?????? ?? ????????? ???????? ?????? ?? ???? ??? ?????? ????? ?? ??????? ??????? ???????? ??. ???? ?????? ??? ????? ????? ??????? ????? ?????? ????????? corrective ????????.

????? ????? ??????? ???? ??? ??????? ????? ??? ???????. ???? ???? ???? ??? ????? ??? ?????? ????????? ?? ????? ???? ?????? ??? ???? ??? ?????? ??? ??? ???????. ???? ?? ???? simulated ?? Visual Basic for Applications ??? ??? ??????? ?????? ????? ??? ????? ??? ?? ????? SQL ???. ????? ????? ??????? ???? ??? ?????? ????? ????? ?? ??? ???????? ?????? ?? ?????? ????? ??? ??? ?? ?????? ?? Visual Basic for Applications ??? ??? ???????. ???? ?????? ???? ????? ??? ????? ??????? ??????? ?? ??? ??????? (??? ?????? "??? ????"). ?? ??? ????? Visual Basic for Applications ?? ?????? ???? ??????? ???????? ????? ???????. ?? ???????? ????????? ?? Visual Basic for Applications ????? ????? ??? ????? ??? ???? ???? - ??? ????? ?? ?????. ?? ???????? ????? ???? ???? ????? ?? 50,000 ?????? ????? ??? 65.535 ????? ????????? ???????? ?? ????????.

???? ????? ??????? ?????? ??? ????? ??? ??????? ??????:
   Sub Test()

      On Error Resume Next
      Error 50000          'set the value of Err to 50000

      If Err = 50000 Then
         MsgBox "my own error occurred"
      End If

   End Sub
				
????? ??????? "??? ??????" ? ???? ???? ????? ???? ????? ??? "??? ??? ????? ??" ??????.

???? CVErr

??? ??????? ?????? CVErr ?????? ??? ?????. ???? ?????? CVErr ????? ???? ??? ?? ???? ????? ?????? ?? ?? ???? ????? ????? ??? ??? ????.
   NoRadius = CVErr(2010)

   NotANumber = 2020
   InvalidArgument = CVErr(NotANumber)
				
?????? ??????? ???? CVErr:
   Public NoRadius, NotANumber

   Sub AreaOfCircle()
      Const PI = 3.142
      NoRadius = CVErr(2010)
      NotANumber = CVErr(2020)
      Radius = CheckData(InputBox("Enter the radius: "))
      If IsError(Radius) Then
         Select Case Radius
            Case NoRadius
               MsgBox "Error: No radius given."
            Case NotANumber
               MsgBox "Error: Radius is not a number."
            Case Else
               MsgBox "Unknown Error."
         End Select
      Else
         MsgBox "The area of the circle is " & (PI * Radius ^ 2)
      End If
   End Sub

   Function CheckData(TheRadius)
      If Not IsNumeric(TheRadius) Then
         CheckData = NotANumber
      ElseIf TheRadius = 0 Then
         CheckData = NoRadius
      Else
         CheckData = TheRadius
      End If
   End Function
				

???????? ??? ??? ?????

???? ???? ??? ??? ??????? ?? Excel ?? Mac. ???? ?????? ?????? ??? ????? (????) ???? ????? ??????? ???? ????? ???????.
Error number (Constant)   Literal error value     Converted error value

xlErrDiv0                   [#DIV/0!]               CVErr(xlErrDiv0)
xlErrNA                     [#N/A]                  CVErr(xlErrNA)
xlErrName                   [#NAME?]                CVErr(xlErrName)
xlErrNull                   [#NULL!]                CVErr(xlErrNull)
xlErrNum                    [#NUM!]                 CVErr(xlErrNum)
xlErrRef                    [#REF!]                 CVErr(xlErrRef)
xlErrValue                  [#VALUE!]
CVErr(xlErrValue)
				
????? ?? ??? ????? ????? ???? ????? ??????? ???? ??????? ???? ?????? ?? ??????? ??????? ?? ??? ????????--?????? ??????? ??? ??? ??? ???????? ?????? CVErr. ???????? ?????? ???? ????? ???? ?????, Visual Basic for Applications ???? ???? ????? ?????? ??????? ????? ????? ??? ????? ???????. ?? ??? ????? ??? ??????? ?? ??? ??? ????? ?? ??? ????????. ??? ??? ??? ????? ??????? ?? ????? ????? ??? ?? ???? ?? ?????? ?????.

?????? ??????? ??? ??? ?????:
   Function Commission(SharesSold,PricePerShare)
      If Not (IsNumeric(SharesSold) And IsNumeric(PricePerShare)) Then
         Commission = CVErr(xlErrNum)
      Else
         TotalSalePrice = ShareSold * PricePerShare
         If TotalSalePrice <= 15000 Then
            Commission = 25 + 0.03 * SharesSold
         Else
            Commission = 25 + 0.03 * (0.9 * SharesSold)
         End If
      End If
   End Function
				

????? ???????? ??? ?????? ???

??? ????? ????????? ???????? ?????? ??????? ??? Visual Basic ?????? ??????? ??????? ???? ????? ????? ??? ??? ????????? ???? ?? ???????? ????. ????? ????? ??? ????????? ???????? ?????? ???????? ?????? ??????? ?????? ?? ???? ????? ??? ????????? ???? ???? ??????? ????????? ???????? ?????? ??????? ??????? ????? ????? ???????.

?????? ?????? ?? ???? ????? ?????? ???? ???? ????? ???????? ??? ????? ???? ??? ? ????? ???? ? ???? ?????????? ?????? ??????? ???? ??? ?????? ??????? ?? ???? ?????? ?? ????. ?? ???? ?????? ??? ????? ??? ??????? ???? ???? ????.
   Public Const RESUME_STATEMENT = 0   'Resume
   Public Const RESUME_NEXT = 1        'Resume Next
   Public Const UNRECOVERABLE = 2      'Unrecoverable error
   Public Const UNRECOGNIZED = 3       'Unrecognized error
   Public Const ERR_DEVICEUNAVAILABLE = 68
   Public Const ERR_BADFILENAMEORNUMBER = 52
   Public Const ERR_PATHDOESNOTEXIST = 76
   Public Const ERR_BADFILEMODE = 54

   Function FileErrors(errVal As Integer) As Integer
   Dim MsgType As Integer, Msg As String, Response As Integer
      MsgType = vbExalamation
      Select Case errVal
         Case ERR_DEVICEUNAVAILABLE     'Error #68
            Msg = "That device is unavailable."
            MsgType = MsgType + vbAbortRetryIgnore
         Case BADFILENAMEORNUMBER      'Errors #64 & 52
            Msg = "That filename is not valid."
            MsgType = MsgType + vbOKCancel
         Case PATHDOESNOTEXIST      'Error #76
            Msg = "That path does not exist."
            MsgType = MsgType + vbOKCancel
         Case BADFILEMODE      'Error #54
            Msg = "Can not open the file for that type of access."
            MsgType = MsgType + vbOKCancel
         Case Else
            FileErrors = UNRECOGNIZED
            Exit Function
      End Select
      Response = MsgBox(Msg, MsgType, "Disk Error")
      Select Case Response
         Case vbOK, vbRetry
            FileErrors = RESUME_STATEMENT
         Case vbIgnore
            FileErrors = RESUME_NEXT
         Case vbCancel, vbAbort
            FileErrors = UNRECOVERABLE
         Case Else
            FileErrors = UNRECOGNIZED
      End Select
   End Function
				

?????? ?????? ????????

???? ??????? ???????? Visual Basic for Applications ??????? ?????? ??? COMMAND + ????. ?? ?????? ????? ????????? ?????? ??? ??????? ?? ????????? ????????. ??? ???? ?? ???? ??? ????? ????????? ???????? ?? ????? ?????? ????? ?????? ?? ?? ??????? ????? ?? ?????? ??? ???? ?????? ???? ???? ???? ????? ????? ?? ??? ??????? ???????? ???????? ?? ??????? ??????? ??????? ??? ????? ?????? ??????? ??? ????????.

????? ????? ????????? ???????? ?? ????????? ?????? ?? ?? ???? ????? ????? EnableCancelKey ??? xlErrorHandler. ??? ????? ??? ??????? ??? ????? ???? ????????? ?? ??? ??????? ??? ????? 18, ???? ???? ?? ???? trapped ???????? ????? SQL ??? ???. ????? ?????? ??? ???? ??????? ?????? ????????. ??? ?? ??????? ???? ??????? ??????? ??????? ??? ??? ??? ??????? ???????, ??? ????? ????????.

?? ?????? ????? ????? ????????? ???????? ???? ???? ?????? ????? ??????? EnableCancelKey ??? xlDisabled. ?? ??? ?????? ?????? Excel ????? ??????? Mac ???? ??????? ?? ??? ???????? ??????? ??????? ??? ???????. ???????? ???????? ????????? ?????? ????? ????? ??????? EnableCancelKey ??? xlInterrupt. ???? ????? ?? ????? ????????? ???????? ???? ???? Excel ????? ??????? Mac ????? ??????? ??????? ????????? ??????? EnableCancelKey ??? xlInterrupt ??? ?????? ??????? ??????? ????? ??. ?????? ?? ?????? ????????? ???? ???? ??? ????????? ???????? ??? ???? ???? ????? ?? ?????? ????????? ?? ?? ??? ??? ???? ????? ???????. ??? ?????? ???? ?? ??? ??????? ??? ????? ???????? ???? ??? ??? ??????? ?? ??? ??????? ??? ????? ????? ????? ??? ??????? ??????? ??? ???????.

???? ?????? ?????? ????? ????? ????? ???? ?? ????? ??????. ??? ??? ?????? ??????? ???????, ??? trapped ???. ???? ???????? ???????? ????? ??? ?? ???? ?????? ????? ??????? ??? ?? ???? ??????? ?????? orderly.
   Sub ProcessData()
      'Set up a user interrupt trapping as a run-time error
      On Error GoTo UserInterrupt
      Application.EnableCancelKey = xlErrorHandler

      'Start a long duration task
      For x = 1 to 1000000
         For y = 1 to 10
         Next y
      Next x

      Exit Sub
   UserInterrupt:
      If Err = 18 Then
         If MsgBox ("Stop processing records?", vbYesNo) = vbNo Then
            'Continue running at the point procedure was interrupted
            Resume
         Else
            'Handle other errors that occur
            MsgBox Error(Err)
         End If
      End If
   End Sub
				
??? ??? ?????? ????? ProcessData ???? CTRL + BREAK ????? ???? ???? ????? ?????? ?? ??? ??? ???? ????? ?????? ???????. ??? ??? ?????? ??? "???" ? ???? ???? ????? ??? ???????? "??? ???????? ????????". ??? ??? ?????? ??? ????? ?? ???? ??????? ??? ????? ???????. ??? ??? ?????? ??? ?? ?? ???? ??????? ????? ? ????? ???????.

???? ?????? ???????

???? ??????? ??????? ?????? ????????? ???????? ??? ?????? ??? ?????? ?????.

???????

???? ???????: 193247 - ????? ??? ??????: 04/????/1428 - ??????: 5.4
????? ???
  • Microsoft Excel 2004 for Mac
  • Microsoft Excel X ?? Mac
  • Microsoft Excel 2001 ?? Macintosh
  • Microsoft Excel 98 ?? Macintosh
????? ??????: 
kbmt kbdtacode kbhowto KB193247 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????193247

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com