I working in a system called ClearQuest. It allows the use of calling hooks written with VBScript but it is giving me some issues on this one particular piece.
I have created a listbox that when a button is pressed shows all the files in a particular directory.
Function templates_ShowFolderList(param)
' param As Variant
' record type name is Templates
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fso.GetFolder("c:\Templates"
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbLf
' SetFieldValue "Template_Names", f1.name
Next
ShowFolderList = s
SetFieldValue "Template_Names", s
End Function
This works like a charm. Now I need another button on the form that allows the document selected to open when selected.
I've added the button and have been trying to get this to work using :
Function templates_GetDocument(param)
' param As Variant
' record type name is Templates
const lstrTemplatePath = "c:\Templates\"
Dim lstrOpenFile
Dim fso
Dim ts
Dim word_app
Dim template_file
Dim curr_document
lstrOpenFile = GetFieldValue("Template_Names".GetValue
template_file = lstrTemplatePath
set word_app = CreateObject("Word.Application"
set curr_document = word_app.Documents.Open template_file)
word_app.visible = true
End Function
I've been working on this for the last 15 hours or so and am beginning to go blind (and make stupid mistakes) so I was wondering if anyone had any thoughts...
MUCH MUCH Appreciated!!!!
Billy
I have created a listbox that when a button is pressed shows all the files in a particular directory.
Function templates_ShowFolderList(param)
' param As Variant
' record type name is Templates
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fso.GetFolder("c:\Templates"
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbLf
' SetFieldValue "Template_Names", f1.name
Next
ShowFolderList = s
SetFieldValue "Template_Names", s
End Function
This works like a charm. Now I need another button on the form that allows the document selected to open when selected.
I've added the button and have been trying to get this to work using :
Function templates_GetDocument(param)
' param As Variant
' record type name is Templates
const lstrTemplatePath = "c:\Templates\"
Dim lstrOpenFile
Dim fso
Dim ts
Dim word_app
Dim template_file
Dim curr_document
lstrOpenFile = GetFieldValue("Template_Names".GetValue
template_file = lstrTemplatePath
set word_app = CreateObject("Word.Application"
set curr_document = word_app.Documents.Open template_file)
word_app.visible = true
End Function
I've been working on this for the last 15 hours or so and am beginning to go blind (and make stupid mistakes) so I was wondering if anyone had any thoughts...
MUCH MUCH Appreciated!!!!
Billy