neilholmes
New Member
- Joined
- Feb 17, 2011
- Messages
- 13
Hi all,
I am currently writing a vb code that when used does several different tasks... One of the tasks involves the code opening a word template:
This works fine. However in using this code, the path needs to be changed for each word document opened, and therefore a code written for each path.
I would like the code to look up the path based on a reference in a cell. So the path is not actually written in the code. For example cell A1 contains the path (text) "E:\FUND1.dot". My code would therefore go to cell A1 for the file it needs to open. Something look something like this:
But obviously its not that simple... Can anyone help with this please ?
Thanks
- Neil
I am currently writing a vb code that when used does several different tasks... One of the tasks involves the code opening a word template:
Code:
' The following code opens the relevent template file - FUND1 Template
Set wordapp = CreateObject("word.Application")
wordapp.documents.Open "E:\FUND1.dot"
wordapp.Visible = True
This works fine. However in using this code, the path needs to be changed for each word document opened, and therefore a code written for each path.
I would like the code to look up the path based on a reference in a cell. So the path is not actually written in the code. For example cell A1 contains the path (text) "E:\FUND1.dot". My code would therefore go to cell A1 for the file it needs to open. Something look something like this:
Code:
' The following code opens the relevent template file - FUND1 Template
Set wordapp = CreateObject("word.Application")
wordapp.documents.Open "A1"
wordapp.Visible = True
But obviously its not that simple... Can anyone help with this please ?
Thanks
- Neil