Hey,
Here is another one that creates a simple temporary text file and then displays it in Notepad from a button in the form template.
Sub btnCreateTempFile_OnClick(eventObj)
' Write your code here
Const iTempFolder = 2
Dim oFS, oTempFolder, sFile, oTempFile, wshShell
Dim sRun, sTemp
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oTempFolder = oFS.GetSpecialFolder(iTempFolder)
sFile = oFS.GetTempName
sTemp = oFS.GetSpecialFolder(iTempFolder)
If Right(sTemp,1) <> "\" Then
sTemp = sTemp & "\" & sFile
Else
sTemp = sTemp & sFile
End If
Set oTempFile = oTempFolder.CreateTextFile(sFile)
oTempFile.WriteLine "Temp File created on " & Now()
'show it in notepade
Set wshShell = Createobject("WScript.Shell")
sRun = "notepad.exe " & sTemp
wshShell.Run sRun
wshShell.AppActivate "NotePad"
End Sub