Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error I can't work out?!?!?

Status
Not open for further replies.

STU1979

Technical User
Mar 5, 2002
53
GB
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


 
If printResult = 7 Then Exit Sub
If printResult = 6 Then
...
End If
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Now I get this?

Description: Expected end of statement

Line: 19
 
In VBScript you can't use typed variables:
Dim objItem, _
objFile, _
strFilename

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Can you suggest a way I can adapt the 2nd section of the script?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top