Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

opening different templates

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Opening different templates

Opening different templates

ResolvedVersion 2010

Vicki has attended:
Excel VBA Introduction course

Opening different templates

Hi, does anyone know what script I need to write, or even if it can be done, I have 2 radio buttons, I want to say if radio button 1 is clicked open up this template, if radio button 2 is clicked open up the other template.

I have currently only set up one word doc at the beginning of my script (per below) and think I probably need to amend this part or do I just need to put my if command at the beginning of the script below and change the 'open' template to a different one each time?


Dim wapp As Word.Application
Dim wdoc As Word.Document
Set wapp = CreateObject("Word.Application")
Set wdoc = wapp.Documents.Open("J:\SoDaN Test\Sodan Advised.dotx")
wapp.Visible = True

Thanks so much

RE: Opening different templates

Hi Vicki,

Thank you for the forum question.

You will just need a decision code.

Dim wapp As Word.Application
Dim wdoc As Word.Document
Set wapp = CreateObject("Word.Application")

If Radio_button1=True then
Set wdoc = wapp.Documents.Open("J:\SoDaN Test\Sodan Advised.dotx")
wapp.Visible = True

else
Set wdoc = wapp.Documents.Open("J:\SoDaN Test\The seconde template.dotx")
wapp.Visible = True
end if




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

##### displaying in Excel

When you get a series of hash symbols (####) appearing in some of your cells in a spreadsheet, this can make you think that you've make some kind of mistake.

This is a common misconception - what this actually means is that the cell is not wide enough to fully display the content of the cell.

All you need to do to see what is actually in the cell is to widen the column that the cell is in.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.