PC Review


Reply
Thread Tools Rate Thread

add attachment to post form OL2K3

 
 
New Member
Join Date: May 2007
Posts: 2
 
      3rd Mar 2009
I need to be able to add attachments, whether from the local drive, network drive, or document management system. I have a post form that sends a plain text message to a helpdesk ticketing system, and I need to be able to open the attachments there, or anywhere. I'm not sure what to do with the following code:

Const olByValue = 1
objForward.Attachments.Add "C:\my file.doc", olByValue

...or where to put it in the code for my form:

'*****************************************************
'
'Computer-Support Request Form
'
'*****************************************************


Dim m_blnUserSent
Const olDiscard = 1

Function Item_Write()
MsgBox "This form cannot be saved. " & _
"Please select No when asked to save " & _
"to close this form once you have " & _
"completed your request. You will recieve " & _
"a ticket number, which confirms that your " & _
"request has been received."
Item_Write = False
End Function

Function Item_Close ()
Dim intRes
Dim strMsg
If Not M_blnUserSent Then
strMsg = "You have not yet sent this request. " & _
"Do you really want to discard it?"
intRes = MsgBox (strMsg, vbYesNo + vbQuestion, _
"Abandon Request")
If intRes = vbNo Then
Item_Close = False
Else
Item.Close olDiscard
End if
End If
End Function

Sub cmdSubmit_Click ()
Dim strDetails
Dim objForward
On Error Resume Next
strDetails = Item.Body
Item.BodyFormat = 1
strBody = AddLine ("Subject") & _
AddLine ("Locations") & _
AddLine ("Dept.") & _
AddLine ("Phone Number") & _
AddLine ("Cat") & _
AddLine ("Product") & _
AddLine ("Symptoms") & _
AddLine ("Priorities")
If strDetails <> "" Then
strBody = strBody & vbCrLf & strDetails
End If
Set objForward = Item.Forward
objForward.Body = strBody

vMessage = ": " & CRLF
missingData = False

If ValidateField ("Subject") = False Then
vMessage = vMessage & "Subject " & CRLF
missingData = True
End If

If ValidateField ("Locations") = False Then
vMessage = vMessage & "Location " & CRLF
missingData = True
End If

If ValidateField ("Dept.") = False Then
vMessage = vMessage & "Department " & CRLF
missingData = True
End If

If ValidateField ("Phone Number") = False Then
vMessage = vMessage & "Telephone Number " & CRLF
missingData = True
End If

If ValidateField ("Cat") = False Then
vMessage = vMessage & "Category " & CRLF
missingData = True
End If

If ValidateField ("Product") = False Then
vMessage = vMessage & "Product " & CRLF
missingData = True
End If

If ValidateField ("Symptoms") = False Then
vMessage = vMessage & "Symptom " & CRLF
missingData = True
End If

If missingData = True Then
Err.Raise vbObjectError+2048
Else
objForward.Send
End If

If Err = 0 Then
m_blnUserSent = True
msgBox "Request has been submitted. If this " & _
"issue is not addressed in a timely manner, it " & _
"will be automatically escalated. Please " & _
"do not re-submit this request." , , _
"Computer Support Request"
ElseIf Err = vbObjectError+2048 Then
MsgBox "The following fields must be populated" & CRLF & vMessage , , _
"Computer Support Request"
Else
MsgBox "Request has not been submitted. Error occurred." & Err.Description, , _
"Computer Support Request"
End If

Err.Clear

Item.Close olDiscard
End Sub

Function ValidateField(strProp)
Dim objProp
On Error Resume Next
Set objProp = Item.UserProperties (strProp)

If objProp.Value <> "" Then
ValidateField = True
Else
ValidateField = False
End If
Err.Clear
End Function

Function AddLine (strProp)
Dim objProp
Dim strLine
On Error Resume Next
Set objProp = Item.UserProperties (strProp)
strLine = strProp & ": "
If Not objProp Is Nothing Then
strLine = strLine & objProp.Value
Else
strLine = strLine & "Property not available"
End If
AddLine = strLine & vbCrLf
End Function
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I post to my website a downloadable .pdf attachment? =?Utf-8?B?YnVzb3JhcA==?= Microsoft Frontpage 1 8th Jul 2006 10:08 PM
Outlook 2003 - show attachment dialog in a custom post form and testattachment Urs Ruefenacht Microsoft Outlook Form Programming 1 23rd Feb 2005 03:30 PM
WARNING VIRUS ATTACHMENT IN ABOVE POST KHRI Microsoft Access 0 9th Sep 2004 04:52 PM
Re: Post message with Attachment Tom Microsoft Access Forms 5 29th Oct 2003 12:42 AM
yet another attachment post Inferno Microsoft Outlook 0 7th Aug 2003 02:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:27 PM.