I'm not really a programmer and I am trying to piece together some code. The first section of the code is simply a reg key change which owrks fine. The second part should be a prompt whether to print or not but I get an error message saying there is an error in line 16.
Hopefully someone maybe able to help. The code is below:
Sub IManFileSaveCmd_PostOnOK(dlg)
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Interwoven\WorkSite\8.0\iManExt\BrowseDlg\Last Location"
strValueName = "Path"
stringValue = ""
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,stringValue
printResult = msgbox("Do you want to Print",4)
If printResult = 7 then end sub
elseif printResult = 6 Then
Dim objItem As Object, _
objFile As Object, _
strFilename As String
Set objItem = Application.ActiveInspector.CurrentItem
If objItem.Class = olMail Then
objItem.PrintOut
For Each objFile In objItem.Attachments
'Change the path on the next line to one that can hold temp files
strFilename = "C:\windows\temp\" & objFile.FileName
objFile.SaveAsFile strFilename
ShellExecute 0&, "print", strFilename, 0&, 0&, 0&
Next
End If
Set objFile = Nothing
Set objItem = Nothing
End Sub
Hopefully someone maybe able to help. The code is below:
Sub IManFileSaveCmd_PostOnOK(dlg)
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Interwoven\WorkSite\8.0\iManExt\BrowseDlg\Last Location"
strValueName = "Path"
stringValue = ""
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,stringValue
printResult = msgbox("Do you want to Print",4)
If printResult = 7 then end sub
elseif printResult = 6 Then
Dim objItem As Object, _
objFile As Object, _
strFilename As String
Set objItem = Application.ActiveInspector.CurrentItem
If objItem.Class = olMail Then
objItem.PrintOut
For Each objFile In objItem.Attachments
'Change the path on the next line to one that can hold temp files
strFilename = "C:\windows\temp\" & objFile.FileName
objFile.SaveAsFile strFilename
ShellExecute 0&, "print", strFilename, 0&, 0&, 0&
Next
End If
Set objFile = Nothing
Set objItem = Nothing
End Sub