View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Stephen Bullen Stephen Bullen is offline
external usenet poster
 
Posts: 67
Default Using Userform object in Excel via automation from VB 6

Hi Howard,

It has to be a Userform that is run via Automation.


Just curious, but why? It's not something I've ever come across
before.

Is there a way to reference the created Userform directly?
I 've not found a way to do that.


The 'Inside' of the userform - i.e. everything in the 'client' part of
the window can be accessed via the VBComponent's Designer property,
which returns an object of type UserForm, for you to access all the
controls on the form, etc.

The 'Outside' of the userform - i.e. the size, caption etc can only (to
my knowledge) be controlled using the VBComponent's Properties
collection.

The .Show still does not work.


In the same way the we can't show a form in one project from code in a
different project, I don't think we can directly show a VBA userform
using automation. The best we can do is to add a standard module, add
code to it to display the form, then use Application.Run to call it, as
you've done.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk