98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Opening different templates
Opening different templates
Resolved · Low Priority · Version 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 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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Add Text to Displayed Numbers in Excel 2010To add text to a number in a cell, you need to go to the Home tab on the Ribbon, and click on the Cells group. Select Format Cells from the drop down menu then Custom from the Category list. In the Type box select General. After the word General, enter a space, then opening quotation marks, then the word you want to type and then closing quotation marks. Click on OK and you have your text! |