BC30828: 'As Any' is not supported in 'Declare' statements

The Any data type was used with Declare statements in Visual Basic 6.0 and earlier versions to permit the use of arguments that could contain any type of data. Visual Basic supports overloading, however, and so makes the Any data type obsolete.

Error ID: BC30828

To correct this error

  1. Declare parameters of the specific type you want to use; for example.

    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (
        ByVal lpBuffer As String,
        ByRef nSize As Integer) As Integer
    
  2. Use the MarshalAsAttribute attribute to specify As Any when Void* is expected by the procedure being called.

    Declare Sub SetData Lib "..\LIB\UnmgdLib.dll" (
        ByVal x As Short,
        <System.Runtime.InteropServices.MarshalAsAttribute(
            System.Runtime.InteropServices.UnmanagedType.AsAny)>
            ByVal o As Object)
    

See also