Run time Error 2777

"Error 2777 run time error, The Class argument in the Create Object Function of the Visual Basic Procedure you are trying to run is in valid." Run time Error 2777, occurs when user uses the wrong Class name for particular object. In this article we explain the reason and resolution of run time error 2777.

Reasons:

Class name for that particular object is not valid.

File is not successfully installed on user computer.

Might user choose wrong file name.

Class is not accessible.

In this article when we are using the OLECreateEmbed action and specified class name argument is not specified or is invalid, then error 2777 will resume. For example to embed a PNG image object, we need to specify the class Paint.Picture. Similarly for JPEG file we need to use Bitmap Image class name. Object name is depending upon class. So class name should be correct otherwise run time error 2777 will occur as shown in Fig 1.1.

MS Access VBA Run time error 2777 Fig 1.1

Fig 1.1

Resolution:

Check the OLE server's documentation for information about the syntax to use when specifying an OLE object's data and make sure the file is installed on user computer and that you used the correct file name.

Note:

In MS Office, to embed the object in OLE Field, by default class names are coming in insert object option, when we right click on OLE field. For custom classes or other types file user can browse the file and can use the object as shown in Fig 1.2.

MS Access VBA Run time error 2777 Fig 1.2

Fig 1.2


DISCLAIMER

It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. Access Guru will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.