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