User Form Tasks



mully
07-09-2005, 11:02 PM
Hi All

In MailMerge I have used details from an Excel Sheet which has several
columns with Name/ Address/ Contact Info etc. I have created the MailMerge
into 3 templates i.e. Labels / Letter / Permit. If I create a user form with
3 Command Buttons named respectively Labels / Letter / Permit and on clicking
the respective buttons it will open the template ready for use e.g. click on
Labels and the whole shebang opens ready to print the 250 or so Labels.
What code would I need to put in the VBA Modules.

To take it a stage further we have a User Form in Excel is it possible to
put 3 extra buttons on the Excel User Form and go straight into MailMerge as
above.

Any help much appreciated

Cheers ------ Mully

Charles Kenyon
07-09-2005, 11:02 PM
First, do not "open" the templates. Create new documents based on them. This
is done with the Documents.Add command.

Second, you can do this within your Excel UserForm so long as you specify
the application (Word) and it is available.

I'm not about to write your code for you without being paid (and you can
find better and cheaper programmers). However, take a look at
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm,
http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm and
http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm. What I would do
if I were attempting to write your code would probably be to start by
recording a macro for each of your templates that (1) creates a new document
based on the template, (2) performs a merge with your data and possibly (3)
prints your new merged document. Save the macros and use them as a starting
point. That would at least give the appropriate collections and commands
although it would probably have a lot of excess code. I would then work on
cleaning out the excess and modifying the code so it would work in your
Excel form. http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm
http://word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

Hope this helps get you started. Once you have actual code if you run into
problems, post back in the word.vba.beginners or word.vba.userforms
newsgroups.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"mully" <mully@discussions.microsoft.com> wrote in message
news:23E0881F-1D41-4667-9968-55DEAE6F799A@microsoft.com...
> Hi All
>
> In MailMerge I have used details from an Excel Sheet which has several
> columns with Name/ Address/ Contact Info etc. I have created the MailMerge
> into 3 templates i.e. Labels / Letter / Permit. If I create a user form
> with
> 3 Command Buttons named respectively Labels / Letter / Permit and on
> clicking
> the respective buttons it will open the template ready for use e.g. click
> on
> Labels and the whole shebang opens ready to print the 250 or so Labels.
> What code would I need to put in the VBA Modules.
>
> To take it a stage further we have a User Form in Excel is it possible to
> put 3 extra buttons on the Excel User Form and go straight into MailMerge
> as
> above.
>
> Any help much appreciated
>
> Cheers ------ Mully
>

mully
07-09-2005, 11:02 PM
Hi

I have done as you suggested and made templates of the originals and started
to write the macro's - if anything doesn't fall in to place will come back
with the questions. Thanks again

Mully

"Charles Kenyon" wrote:

> First, do not "open" the templates. Create new documents based on them. This
> is done with the Documents.Add command.
>
> Second, you can do this within your Excel UserForm so long as you specify
> the application (Word) and it is available.
>
> I'm not about to write your code for you without being paid (and you can
> find better and cheaper programmers). However, take a look at
> http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm,
> http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm and
> http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm. What I would do
> if I were attempting to write your code would probably be to start by
> recording a macro for each of your templates that (1) creates a new document
> based on the template, (2) performs a merge with your data and possibly (3)
> prints your new merged document. Save the macros and use them as a starting
> point. That would at least give the appropriate collections and commands
> although it would probably have a lot of excess code. I would then work on
> cleaning out the excess and modifying the code so it would work in your
> Excel form. http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm
> http://word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm
>
> Hope this helps get you started. Once you have actual code if you run into
> problems, post back in the word.vba.beginners or word.vba.userforms
> newsgroups.
> --
> Charles Kenyon
>
> Word New User FAQ & Web Directory: http://addbalance.com/word
>
> Intermediate User's Guide to Microsoft Word (supplemented version of
> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>
> See also the MVP FAQ: http://www.mvps.org/word which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
>
> "mully" <mully@discussions.microsoft.com> wrote in message
> news:23E0881F-1D41-4667-9968-55DEAE6F799A@microsoft.com...
> > Hi All
> >
> > In MailMerge I have used details from an Excel Sheet which has several
> > columns with Name/ Address/ Contact Info etc. I have created the MailMerge
> > into 3 templates i.e. Labels / Letter / Permit. If I create a user form
> > with
> > 3 Command Buttons named respectively Labels / Letter / Permit and on
> > clicking
> > the respective buttons it will open the template ready for use e.g. click
> > on
> > Labels and the whole shebang opens ready to print the 250 or so Labels.
> > What code would I need to put in the VBA Modules.
> >
> > To take it a stage further we have a User Form in Excel is it possible to
> > put 3 extra buttons on the Excel User Form and go straight into MailMerge
> > as
> > above.
> >
> > Any help much appreciated
> >
> > Cheers ------ Mully
> >
>
>
>


User Form Tasks