PutUserLayerGfx component argument set to Nothing does not work in Microsoft Visual Basic

Discussion created by mgeisler on May 12, 2014
Latest reply on Aug 26, 2014 by mgeisler

I am using the PutUserLayerGfx Method in my Microsoft Visual Basic 2010 program and I do not want the graphics to be attached to a component so I set the argument to Nothing.

From the automation reference:

The component (Component) to which this user layer graphics is added. Specify Nothing if

the element is not part of a component. Note that, VBScript requires that you specify the

object or Nothing as an argument.


When I run the script, I get a type mismatch error:



System.Runtime.InteropServices.COMException was unhandled




ErrorCode = -2147352571




Message=Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))




Source = Microsoft.VisualBasic


It works fine if I attach it to a component object, but does not recognize "Nothing" as an argument.