A
aehan
Hello everyone
I'm trying to do something that is quite ambitious for me, and I'm getting
nowhere fast. I wonder if anyone has the answer to this.
I'm building toolbars to allow users to open new documents from custom
templates. However, the templates could be on a shared drive or they could
be on the C drive, according to the machine being used.
I've written this (which doesn't work and gives an error), and have been
trying all sorts of workrounds which again don't work. If anyone can help
I'd be grateful and my headache would maybe go.
The code is:
Dim strNetworkPath As String
Dim strCPath As String
Sub OpenLetter()
strNetworkPath = "G:\Documents and Settings\"%USERNAME%"\Application
Data\Microsoft\Templates\My Templates\"
strCPath = "%USERPROFILE%"\Application Data\Microsoft\Templates\My Templates\"
' Opens document based on letter template
Dim strname As String
If Application(strNetworkPath).Found Then
strFile = strNetworkPath & Letter.dot
Else
strFile = strCPath & Letter.dot
End If
Documents.Add Template:=strFile, NewTemplate:=False, DocumentType:=0
End Sub
I'm trying to do something that is quite ambitious for me, and I'm getting
nowhere fast. I wonder if anyone has the answer to this.
I'm building toolbars to allow users to open new documents from custom
templates. However, the templates could be on a shared drive or they could
be on the C drive, according to the machine being used.
I've written this (which doesn't work and gives an error), and have been
trying all sorts of workrounds which again don't work. If anyone can help
I'd be grateful and my headache would maybe go.
The code is:
Dim strNetworkPath As String
Dim strCPath As String
Sub OpenLetter()
strNetworkPath = "G:\Documents and Settings\"%USERNAME%"\Application
Data\Microsoft\Templates\My Templates\"
strCPath = "%USERPROFILE%"\Application Data\Microsoft\Templates\My Templates\"
' Opens document based on letter template
Dim strname As String
If Application(strNetworkPath).Found Then
strFile = strNetworkPath & Letter.dot
Else
strFile = strCPath & Letter.dot
End If
Documents.Add Template:=strFile, NewTemplate:=False, DocumentType:=0
End Sub