The first step to incorporating different code for different containers is having your ActiveX document detect what type of container is being used. The Parent method of the UserDocument and the TypeName function can both be used to obtain information about the container application. UserDocument.Parent is used to return the name of the container.