Group: microsoft.public.word.vba.general
From: IdontWantSpam@nospam.net (Edward Thrashcort)
Date: Tuesday, October 23, 2007 3:34 PM
Subject: Re: Any way to close a UserForm from another macro or with sendkeys?

I thought it was the new document that runs the auto open macro?
If so, this macro can access the document variable like this for example

if Documents("caller.doc").Variables("newdoc_opened") = True then

Eddie

> *From:* src
> *Date:* Wed, 25 Jul 2007 12:28:05 -0700
>
> Thanks, Eddie.
>
> I thought about the very things you mentioned, but I don't know how to
> implement them.
>
> I set a document variable in the calling document, but once the new
> doc is opened the variable doesn't exist. Seems that document
> variables are not available across multiple documents.
>
> I also tried using the "set" parameter on a variable thinking that
> thay may make the variable available for the Word session and not just
> the calling document.
>
> Can you think of a way to set a variable and have it available in a
> new document?
>
> THANKS,
> Matt
>
>
> On Jul 25, 2:45 am, IdontWantS...@nospam.net (Edward Thrashcort)
> wrote:
> >
> >
> > Can you modify the auto open macro to detect that the calling document
> > is
> > active and only show the userform when it is?
> >
> > If there is a state where the calling document could be open and yet you
> > still don't want the form to display, set a document variable in the
> > calling
> > document before it opens the new document and test its setting with the
> > auto
> > open macro. Remember to unset the variable once the document has been
> > loaded.
> >
> >
> >
> > Eddie
> >
> > > *From:* src
> > > *CC:* m...@starsys.com
> > > *Date:* Tue, 24 Jul 2007 19:34:33 -0700
> >
> > > Hi there,
> >
> > > I have a routine that opens a new document based on a template.
> >
> > > This template has an autonew macro that shows a userform. Normally
> > > this is exactly what I want from this template. But when it's opened
> > > from another document, I'd like to bypass the userform.
> >
> > > Is there a way to skip the userform altogether? If not, is there a
> > > way to automatically close it once it opens?
> >
> > > I've tried sending a simple SendKeys "{ESC}", True, but it appears
> > > that userforms don't respond to this and it won't execute until after
> > > the form is (manually) closed.
> >
> > > THANKS
>
>
>

Safety Articles | News in English | 20lbs in 30 days | Bluegrass | Usenet Newsfeeds