I'm trying to put together a template file that when loaded into Word (2010) via startup, will add a custom tab to the ribbon with some shortcuts to open a selection of templates at a fixed location. I can't for the life of me work out how to get Word to actually open a file via a macro command.
The VBA script I'm trying to use is:
Sub OpenFile1()
Dim wdApp as Object
Set wdApp = CreateObject("Word.Application") - Probably redundant, makes no difference
wdApp.Visible = True
wdApp.Documents.Open Filename:="Filepath+name"
End Sub
The CustomUI.xml code that I'm trying to call it with is:
<button id="button1" label="Open File" size="normal" imageMso="Image" onAction="OpenFile1" />
Any ideas what I'm doing wrong?
I'm trying to make this fairly portable so we can give it to a few people so they've got a quick & simple way of getting at the right set of templates. It looks like it should be fairly easy, but I just get an "invalid property assignment" error.