Autonew macro prompt 
Author Message
 Autonew macro prompt

I have an autonew macro in my Word template that reads as below:  It works
great but instead of a Yes/No click box I would like two buttons that say
Client/Internal.  Therefore, they would open document, get prompted for a
choice as to whether or not they want a cover page (Yes/No).  Then, at the
next prompt they would be asked if they want an Internal or a Client cover
page.

Is this possible?

Many thanks

Chris

If MsgBox("Include Cover Page?", vbYesNo) = vbNo Then
   Exit Sub
Else
   Set r = ActiveDocument.Range
   r.Collapse wdCollapseStart
   If MsgBox("Cover Page [click 'Yes' for Client and 'No' for Internal]?",
vbYesNo) _
     = vbNo Then
         ActiveDocument.AttachedTemplate. _
            AutoTextEntries("Internal Cover Page").Insert _
            Where:=r, RichText:=True
   Else
         ActiveDocument.AttachedTemplate. _
            AutoTextEntries("Client Cover Page").Insert _
            Where:=r, RichText:=True

End If
End If
End Sub



Sun, 09 May 2004 15:29:02 GMT  
 Autonew macro prompt
Actually, on thinking about it, what I want (if I cannot have anything other
than Yes/No buttons) is a prompt as I go in asking whether a cover sheet is
needed.  If Yes, then another prompt asking if I want a Client Cover.  If
Yes, then Client Cover is produced and if No an Internal cover is produced.

Can anyone help me write this - my knowledge is very scant...

Many thanks.

Chris

Quote:
> I have an autonew macro in my Word template that reads as below:  It works
> great but instead of a Yes/No click box I would like two buttons that say
> Client/Internal.  Therefore, they would open document, get prompted for a
> choice as to whether or not they want a cover page (Yes/No).  Then, at the
> next prompt they would be asked if they want an Internal or a Client cover
> page.

> Is this possible?

> Many thanks

> Chris

> If MsgBox("Include Cover Page?", vbYesNo) = vbNo Then
>    Exit Sub
> Else
>    Set r = ActiveDocument.Range
>    r.Collapse wdCollapseStart
>    If MsgBox("Cover Page [click 'Yes' for Client and 'No' for Internal]?",
> vbYesNo) _
>      = vbNo Then
>          ActiveDocument.AttachedTemplate. _
>             AutoTextEntries("Internal Cover Page").Insert _
>             Where:=r, RichText:=True
>    Else
>          ActiveDocument.AttachedTemplate. _
>             AutoTextEntries("Client Cover Page").Insert _
>             Where:=r, RichText:=True

> End If
> End If
> End Sub



Sun, 09 May 2004 15:46:39 GMT  
 Autonew macro prompt

Hi Chris,

To answer your earlier post first: the MsgBox function gives you only
a limited set of available captions for buttons (Yes/No, OK/Cancel,
Abort, Retry, Ignore...) so you can't use it to create descriptively
labeled buttons.  BUT, you could accomplish that with a small userform,
where you can have any number of buttons with any captions you want.  
And, you could build it so that the user would "answer" the screen only
once rather than twice.

This isn't as involved as it may sound, and in fact, if you're new to
userforms, it's probably an ideal first exercise, because it's quite a
simple one.  If this task gets done quite often, a userform would be
a very good investment of your time.  Post back if you're interested.
A userform will also be *expandable* if you come to see other parts of
the task that should be automated -- and believe me, once you get into
the Zen of userforms, you start to see all kinds of ways they can speed
up ordinary tasks.  Plus, they look really neat. ;)   I'll help.

For the quick & dirty fix (using two Yes/No boxes, as below), you really
have it done already.  All you'd need to do to make it look exactly as
you describe is change the second MsgBox prompt (the part in the quotes)
to read "Client cover?"


-- See the MVP FAQ at http://www.mvps.org/word ------------------------
--------------- "Life is nothing if you're not obsessed." --John Waters
-----------------------------------------------------------------------
Please reply only to the newsgroup.

Quote:

> Actually, on thinking about it, what I want (if I cannot have anything other
> than Yes/No buttons) is a prompt as I go in asking whether a cover sheet is
> needed.  If Yes, then another prompt asking if I want a Client Cover.  If
> Yes, then Client Cover is produced and if No an Internal cover is produced.

> Can anyone help me write this - my knowledge is very scant...

> Many thanks.

> Chris


> > I have an autonew macro in my Word template that reads as below:  It works
> > great but instead of a Yes/No click box I would like two buttons that say
> > Client/Internal.  Therefore, they would open document, get prompted for a
> > choice as to whether or not they want a cover page (Yes/No).  Then, at the
> > next prompt they would be asked if they want an Internal or a Client cover
> > page.

> > Is this possible?

> > Many thanks

> > Chris

> > If MsgBox("Include Cover Page?", vbYesNo) = vbNo Then
> >    Exit Sub
> > Else
> >    Set r = ActiveDocument.Range
> >    r.Collapse wdCollapseStart
> >    If MsgBox("Cover Page [click 'Yes' for Client and 'No' for Internal]?",
> > vbYesNo) _
> >      = vbNo Then
> >          ActiveDocument.AttachedTemplate. _
> >             AutoTextEntries("Internal Cover Page").Insert _
> >             Where:=r, RichText:=True
> >    Else
> >          ActiveDocument.AttachedTemplate. _
> >             AutoTextEntries("Client Cover Page").Insert _
> >             Where:=r, RichText:=True

> > End If
> > End If
> > End Sub



Sun, 09 May 2004 17:42:17 GMT  
 Autonew macro prompt
Thanks Mark - I would be interested in a UserForm but I have limited time on
this one as it has to be finished end of play Friday, so might not be able
to do it on this template, unless I can get it done really quickly?

After I send my second message, I realised that having two Yes/No questions
didn't help.  If they said Yes to a cover sheet and were then asked if they
wanted a Client Cover and said No, they wouldn't actually know what they
would get if they said No because they had not been told at this point!

I would need a series of questions - something I was trying to avoid!

Would the userform work in the AutoNew and will it be easy to achieve what I
am trying to achieve.

Many thanks Mark - your help is appreciated.

Chris

Quote:

> Hi Chris,

> To answer your earlier post first: the MsgBox function gives you only
> a limited set of available captions for buttons (Yes/No, OK/Cancel,
> Abort, Retry, Ignore...) so you can't use it to create descriptively
> labeled buttons.  BUT, you could accomplish that with a small userform,
> where you can have any number of buttons with any captions you want.
> And, you could build it so that the user would "answer" the screen only
> once rather than twice.

> This isn't as involved as it may sound, and in fact, if you're new to
> userforms, it's probably an ideal first exercise, because it's quite a
> simple one.  If this task gets done quite often, a userform would be
> a very good investment of your time.  Post back if you're interested.
> A userform will also be *expandable* if you come to see other parts of
> the task that should be automated -- and believe me, once you get into
> the Zen of userforms, you start to see all kinds of ways they can speed
> up ordinary tasks.  Plus, they look really neat. ;)   I'll help.

> For the quick & dirty fix (using two Yes/No boxes, as below), you really
> have it done already.  All you'd need to do to make it look exactly as
> you describe is change the second MsgBox prompt (the part in the quotes)
> to read "Client cover?"


> -- See the MVP FAQ at http://www.mvps.org/word ------------------------
> --------------- "Life is nothing if you're not obsessed." --John Waters
> -----------------------------------------------------------------------
> Please reply only to the newsgroup.


> > Actually, on thinking about it, what I want (if I cannot have anything
other
> > than Yes/No buttons) is a prompt as I go in asking whether a cover sheet
is
> > needed.  If Yes, then another prompt asking if I want a Client Cover.
If
> > Yes, then Client Cover is produced and if No an Internal cover is
produced.

> > Can anyone help me write this - my knowledge is very scant...

> > Many thanks.

> > Chris


> > > I have an autonew macro in my Word template that reads as below:  It
works
> > > great but instead of a Yes/No click box I would like two buttons that
say
> > > Client/Internal.  Therefore, they would open document, get prompted
for a
> > > choice as to whether or not they want a cover page (Yes/No).  Then, at
the
> > > next prompt they would be asked if they want an Internal or a Client
cover
> > > page.

> > > Is this possible?

> > > Many thanks

> > > Chris

> > > If MsgBox("Include Cover Page?", vbYesNo) = vbNo Then
> > >    Exit Sub
> > > Else
> > >    Set r = ActiveDocument.Range
> > >    r.Collapse wdCollapseStart
> > >    If MsgBox("Cover Page [click 'Yes' for Client and 'No' for
Internal]?",
> > > vbYesNo) _
> > >      = vbNo Then
> > >          ActiveDocument.AttachedTemplate. _
> > >             AutoTextEntries("Internal Cover Page").Insert _
> > >             Where:=r, RichText:=True
> > >    Else
> > >          ActiveDocument.AttachedTemplate. _
> > >             AutoTextEntries("Client Cover Page").Insert _
> > >             Where:=r, RichText:=True

> > > End If
> > > End If
> > > End Sub



Mon, 10 May 2004 02:49:39 GMT  
 Autonew macro prompt

Yes, a userform is definitely the answer when you need to avoid bombarding
the user with a series of questions just to get the right answer from 3 or
more possibilities.

As we discussed in private mail I've sent you a sample of what would work.
It wouldn't be at all hard to adapt.  Let me know if it looks OK.  (I'm
just posting this to continue the public thread.)

Mark

Quote:

> Thanks Mark - I would be interested in a UserForm but I have limited time on
> this one as it has to be finished end of play Friday, so might not be able
> to do it on this template, unless I can get it done really quickly?

> After I send my second message, I realised that having two Yes/No questions
> didn't help.  If they said Yes to a cover sheet and were then asked if they
> wanted a Client Cover and said No, they wouldn't actually know what they
> would get if they said No because they had not been told at this point!

> I would need a series of questions - something I was trying to avoid!

> Would the userform work in the AutoNew and will it be easy to achieve what I
> am trying to achieve.

> Many thanks Mark - your help is appreciated.

> Chris


> > Hi Chris,

> > To answer your earlier post first: the MsgBox function gives you only
> > a limited set of available captions for buttons (Yes/No, OK/Cancel,
> > Abort, Retry, Ignore...) so you can't use it to create descriptively
> > labeled buttons.  BUT, you could accomplish that with a small userform,
> > where you can have any number of buttons with any captions you want.
> > And, you could build it so that the user would "answer" the screen only
> > once rather than twice.

> > This isn't as involved as it may sound, and in fact, if you're new to
> > userforms, it's probably an ideal first exercise, because it's quite a
> > simple one.  If this task gets done quite often, a userform would be
> > a very good investment of your time.  Post back if you're interested.
> > A userform will also be *expandable* if you come to see other parts of
> > the task that should be automated -- and believe me, once you get into
> > the Zen of userforms, you start to see all kinds of ways they can speed
> > up ordinary tasks.  Plus, they look really neat. ;)   I'll help.

> > For the quick & dirty fix (using two Yes/No boxes, as below), you really
> > have it done already.  All you'd need to do to make it look exactly as
> > you describe is change the second MsgBox prompt (the part in the quotes)
> > to read "Client cover?"


> > -- See the MVP FAQ at http://www.mvps.org/word ------------------------
> > --------------- "Life is nothing if you're not obsessed." --John Waters
> > -----------------------------------------------------------------------
> > Please reply only to the newsgroup.


> > > Actually, on thinking about it, what I want (if I cannot have anything
> other
> > > than Yes/No buttons) is a prompt as I go in asking whether a cover sheet
> is
> > > needed.  If Yes, then another prompt asking if I want a Client Cover.
> If
> > > Yes, then Client Cover is produced and if No an Internal cover is
> produced.

> > > Can anyone help me write this - my knowledge is very scant...

> > > Many thanks.

> > > Chris


> > > > I have an autonew macro in my Word template that reads as below:  It
> works
> > > > great but instead of a Yes/No click box I would like two buttons that
> say
> > > > Client/Internal.  Therefore, they would open document, get prompted
> for a
> > > > choice as to whether or not they want a cover page (Yes/No).  Then, at
> the
> > > > next prompt they would be asked if they want an Internal or a Client
> cover
> > > > page.

> > > > Is this possible?

> > > > Many thanks

> > > > Chris

> > > > If MsgBox("Include Cover Page?", vbYesNo) = vbNo Then
> > > >    Exit Sub
> > > > Else
> > > >    Set r = ActiveDocument.Range
> > > >    r.Collapse wdCollapseStart
> > > >    If MsgBox("Cover Page [click 'Yes' for Client and 'No' for
> Internal]?",
> > > > vbYesNo) _
> > > >      = vbNo Then
> > > >          ActiveDocument.AttachedTemplate. _
> > > >             AutoTextEntries("Internal Cover Page").Insert _
> > > >             Where:=r, RichText:=True
> > > >    Else
> > > >          ActiveDocument.AttachedTemplate. _
> > > >             AutoTextEntries("Client Cover Page").Insert _
> > > >             Where:=r, RichText:=True

> > > > End If
> > > > End If
> > > > End Sub



Mon, 10 May 2004 04:28:18 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. AutoNew Macro

2. AutoNew: Run macro when new drawing is created?

3. Word VBA AutoNew macros fail to start

4. template question/normal.dot/autonew macro

5. template question/normal.dot/autonew macro

6. HELP! autonew macro

7. Forms, User Forms and the AutoNew macro.

8. How to disable the Outlook prompt when sending e-mail w/ Macro

9. Macro Warning prompt

10. How to turn off Enable/Disable Macro Prompt...

11. User Prompt to change value in Macro

12. Macro Prompt

 

 
Powered by phpBB® Forum Software