Visual Basic

ActiveX Documents

ActiveX documents are an important part of Microsoft's component strategy. The ability to create a Visual Basic 6 application that can be run inside Microsoft Internet Explorer is theoretically very powerful, especially over an intranet where control over the browser being used is possible. Whether this potential will actually be realized is debatable, but Microsoft is certainly putting considerable effort into developing and promoting this technology.

There are some common pitfalls that you need to be aware of, especially when testing the downloading of your ActiveX document into Internet Explorer. One of the first pitfalls comes when you attempt to create a clean machine for testing purposes. If you try to delete or rename the Visual Basic 6 run-time library (MSVBVM60.DLL), you might see errors. These errors usually occur because the file is in use; you cannot delete the run time while Visual Basic is running or if the browser is viewing an ActiveX document. Try closing Visual Basic and/or your browser. Another version of this error is "An error has occurred copying Msvbvm60.dll. Ensure the location specified below is correct:". This error generally happens when there is insufficient disk space on the machine to which you are trying to download. Another pitfall pertaining to MSVBVM60.DLL that you might encounter is receiving the prompt "Opening file DocumentName.VBD. What would you like to do with this file? Open it or save it to disk?" This happens if the Visual Basic run time is not installed, typically because the safety level in Internet Explorer is set to High. You should set this level to Medium or None instead, though I would not advise the latter setting.

The error "The Dynamic Link Library could not be found in the specified path" typically occurs when the ActiveX document that you have been trying to download already exists on the machine. Another error message is "Internet Explorer is opening file of unknown type: DocumentName.VBD from…". This error can be caused by one of several nasties. First make sure that you are using the .vbd file provided by the Package and Deployment Wizard. Then check that the CLSIDs of your .vbd and .exe files are synchronized. To preserve CLSIDs across builds in your projects, select Binary Compatibility on the Components tab of the Project Properties dialog box. Next, make sure that your actxprxy.dll file exists and is registered. Also if your ActiveX document is not signed or safe for scripting, you will need to set the browser safety level to Medium. Incidentally, if you erroneously attempt to distribute Visual Basic's core-dependent .cab files, they won't install using a browser safety level of High, since they are not signed either. Finally, do a run-time error check on your ActiveX document, as this error can be caused by errors in the document's initialization code, particularly in the Initialize or InitProperties procedures.