VBA Programming - populate word template with excel button
Hi, I'm new to this forum, I've never used VBA programming before so I'm hoping someone might be able to help me ...
I'm trying to create a form in excel where I press a button at the end of completing my form and it populates a word template with bookmarks outlining where specific fields on my form should be inserted.
I have started with the below script but I've only ever done a very basic course and I'm trying to teach myself, my trainer told me this was advanced so I'm looking for a bit of help as my company won't send me on an intermediate and advanced course yet because I dont' really need it other than to do this so they feel it's a waste of money! this is basically the only reason I need it!
I've done the below, which is at the moment opening my draft word doc but not populating it. At the point where I ask it to select the bookmark I'm not sure what I need to put next, I want to say take the text in textbox1 and put it in the 'reference' bookmark in the word template but I don't know how to tell it to select it and insert it? any help would be really appreciated! Thanks so much!!!
Having the same problem with the radio buttons - asking to select the optionbutton and wanting to it to populate the template bookmark I reference in the script.
hope this makes sense to someone....
Private Sub CommandButton1_Click()
Dim wapp As Word.Application
Dim wdoc As Word.Document
Set wapp = CreateObject("Word.Application")
Set wdoc = wapp.Documents.Open("J:\SoDaN Test\SoDaN Test Template.dotx")
wapp.Visible = True
wapp.Selection.Goto what:=wdGoToBookmark, Name:="Reference"
If Me.OptionButton1 = True Then
wapp.Selection.Goto what:=wdGoToBookmark, Name:="AddOns"
ElseIf Me.OptionButton2 = True Then
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By WHansen in forum Excel General
Last Post: 02-16-2015, 03:38 PM
By DellRussellHWS in forum Excel Programming / VBA / Macros
Last Post: 09-03-2014, 04:33 PM
By laralara in forum Excel Programming / VBA / Macros
Last Post: 12-16-2013, 08:38 AM
By bruizer31 in forum Excel Programming / VBA / Macros
Last Post: 05-30-2013, 11:29 AM
By hieldy in forum Excel Programming / VBA / Macros
Last Post: 03-05-2013, 05:40 AM
By briancuasito in forum Excel Programming / VBA / Macros
Last Post: 08-21-2009, 04:36 PM
By MS Questionnairess in forum Excel General
Last Post: 06-07-2006, 08:30 PM
Search Engine Friendly URLs by vBSEO 3.6.0 RC 1