Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Forms (http://www.outlookbanter.com/outlook-using-forms/)
-   -   outlook forms scripts (http://www.outlookbanter.com/outlook-using-forms/51626-outlook-forms-scripts.html)

אמיר מצס July 1st 07 08:12 AM

outlook forms scripts
 
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir

Sue Mosher [MVP-Outlook] July 1st 07 02:22 PM

outlook forms scripts
 
By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir


אמיר מצס July 1st 07 02:50 PM

outlook forms scripts
 
thanks,

I created a form with some user fileds.

I want that the recipient will get it as text in the body and not as form.

I search and found some answers in this site but none was worked for me.

the one I tried was:

==================
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
.BodyFormat = olFormatPlain
.Body = Eng.fName.Text ' this is one on the fileds....
Item.Body
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
MsgBox objMsg.Body
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function
===================================
but the message was empty... only the subject was OK.

thanks

Amir.






"Sue Mosher [MVP-Outlook]" wrote:

By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir



אמיר מצס July 1st 07 04:02 PM

outlook forms scripts
 
I can't edit the post so i'll try this:

I can define some vars to contein my text as i need it.

exmp:

=====
sub show_click()
Dim objInsp 'As Object
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
MsgBox line1
set line2 = objControls("Heb.lName")
MsgBox line2
Set objInsp = Nothing
end sub
======
but how can I join both line1 and line2 and make it as the body???

thanks....

Amir

"אמיר מצס" wrote:

thanks,

I created a form with some user fileds.

I want that the recipient will get it as text in the body and not as form.

I search and found some answers in this site but none was worked for me.

the one I tried was:

==================
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
.BodyFormat = olFormatPlain
.Body = Eng.fName.Text ' this is one on the fileds....
Item.Body
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
MsgBox objMsg.Body
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function
===================================
but the message was empty... only the subject was OK.

thanks

Amir.






"Sue Mosher [MVP-Outlook]" wrote:

By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir



Sue Mosher [MVP-Outlook] July 1st 07 06:28 PM

outlook forms scripts
 
This statement does not use the correct syntax for returning the value of a custom field:

.Body = Eng.fName.Text ' this is one on the fileds....

See http://www.outlookcode.com/article.aspx?ID=38
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
thanks,

I created a form with some user fileds.

I want that the recipient will get it as text in the body and not as form.

I search and found some answers in this site but none was worked for me.

the one I tried was:

==================
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
.BodyFormat = olFormatPlain
.Body = Eng.fName.Text ' this is one on the fileds....
Item.Body
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
MsgBox objMsg.Body
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function
===================================
but the message was empty... only the subject was OK.

thanks

Amir.






"Sue Mosher [MVP-Outlook]" wrote:

By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function




"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir



Sue Mosher [MVP-Outlook] July 1st 07 06:38 PM

outlook forms scripts
 
To join two strings together, use the & concatenaton character:

strBody = line1.Value & " " & line2.Value

THen use strBody to set the value of the message's Body property.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
I can't edit the post so i'll try this:

I can define some vars to contein my text as i need it.

exmp:

=====
sub show_click()
Dim objInsp 'As Object
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
MsgBox line1
set line2 = objControls("Heb.lName")
MsgBox line2
Set objInsp = Nothing
end sub
======
but how can I join both line1 and line2 and make it as the body???

thanks....

Amir

"אמיר מצס" wrote:

thanks,

I created a form with some user fileds.

I want that the recipient will get it as text in the body and not as form.

I search and found some answers in this site but none was worked for me.

the one I tried was:

==================
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
.BodyFormat = olFormatPlain
.Body = Eng.fName.Text ' this is one on the fileds....
Item.Body
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
MsgBox objMsg.Body
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function
===================================
but the message was empty... only the subject was OK.

thanks

Amir.






"Sue Mosher [MVP-Outlook]" wrote:

By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function

"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir


אמיר מצס July 2nd 07 02:50 PM

outlook forms scripts
 
thanks for your answer...
I have a nother one.

I used the folowing code (some from you and some from someone else) to send
my plain form...

at the send command it gives you a message box that email was send and you
can close the original mail.

Is there any way to close it automaticly??

thanks

amir

=========== the code I used =========
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
strBody = strBody & vbCrLf & " Hebrew First Name: " & line1
set line2 = objControls("Heb.lName")
strBody = strBody & vbCrLf & " Hebrew Last Name: " & line2
set line3 = objControls("Eng.fName")
strBody = strBody & vbCrLf & " English First Name: " & line3
set line4 = objControls("Eng.lName")
strBody = strBody & vbCrLf & " English Last Name: " & line4
set line5 = objControls("JobTitle")
strBody = strBody & vbCrLf & " Job Title: " & line5
set line6 = objControls("telnum")
strBody = strBody & vbCrLf & " Phone: " & line6
set line7 = objControls("dirmanager")
strBody = strBody & vbCrLf & " Direct Manager: " & line7
set line8 = objControls("pernotes")
strBody = strBody & vbCrLf & " Notes: " & line8
.BodyFormat = olFormatPlain
.Body = strBody
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function

========== end of code ==============



"Sue Mosher [MVP-Outlook]" wrote:

To join two strings together, use the & concatenaton character:

strBody = line1.Value & " " & line2.Value

THen use strBody to set the value of the message's Body property.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
I can't edit the post so i'll try this:

I can define some vars to contein my text as i need it.

exmp:

=====
sub show_click()
Dim objInsp 'As Object
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
MsgBox line1
set line2 = objControls("Heb.lName")
MsgBox line2
Set objInsp = Nothing
end sub
======
but how can I join both line1 and line2 and make it as the body???

thanks....

Amir

"אמיר מצס" wrote:

thanks,

I created a form with some user fileds.

I want that the recipient will get it as text in the body and not as form.

I search and found some answers in this site but none was worked for me.

the one I tried was:

==================
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
.BodyFormat = olFormatPlain
.Body = Eng.fName.Text ' this is one on the fileds....
Item.Body
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
MsgBox objMsg.Body
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function
===================================
but the message was empty... only the subject was OK.

thanks

Amir.






"Sue Mosher [MVP-Outlook]" wrote:

By "icon," do you mean a command button control added to a custom page on the form? If so then:

1)

Function CommandButton1_Click()
Item.Send
End Function

2)

Function CommandButton2_Click()
Item.GetInspector.SetCurrentFormPage "page name"
End Function

"אמיר מצס" wrote in message ...
hi,

I need some scripts to:

1. send the form when clicking an icon.
2. move from page to page by icon

I know how to create the icons but I don't know the scipts.

Thanks

Amir



Sue Mosher [MVP-Outlook] July 2nd 07 03:24 PM

outlook forms scripts
 
Outlook version?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
thanks for your answer...
I have a nother one.

I used the folowing code (some from you and some from someone else) to send
my plain form...

at the send command it gives you a message box that email was send and you
can close the original mail.

Is there any way to close it automaticly??

thanks

amir

=========== the code I used =========
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
strBody = strBody & vbCrLf & " Hebrew First Name: " & line1
set line2 = objControls("Heb.lName")
strBody = strBody & vbCrLf & " Hebrew Last Name: " & line2
set line3 = objControls("Eng.fName")
strBody = strBody & vbCrLf & " English First Name: " & line3
set line4 = objControls("Eng.lName")
strBody = strBody & vbCrLf & " English Last Name: " & line4
set line5 = objControls("JobTitle")
strBody = strBody & vbCrLf & " Job Title: " & line5
set line6 = objControls("telnum")
strBody = strBody & vbCrLf & " Phone: " & line6
set line7 = objControls("dirmanager")
strBody = strBody & vbCrLf & " Direct Manager: " & line7
set line8 = objControls("pernotes")
strBody = strBody & vbCrLf & " Notes: " & line8
.BodyFormat = olFormatPlain
.Body = strBody
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function

========== end of code ==============



אמיר מצס July 2nd 07 03:36 PM

outlook forms scripts
 
most outlook 2003 and several outlook 2000

"Sue Mosher [MVP-Outlook]" wrote:

Outlook version?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
thanks for your answer...
I have a nother one.

I used the folowing code (some from you and some from someone else) to send
my plain form...

at the send command it gives you a message box that email was send and you
can close the original mail.

Is there any way to close it automaticly??

thanks

amir

=========== the code I used =========
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
strBody = strBody & vbCrLf & " Hebrew First Name: " & line1
set line2 = objControls("Heb.lName")
strBody = strBody & vbCrLf & " Hebrew Last Name: " & line2
set line3 = objControls("Eng.fName")
strBody = strBody & vbCrLf & " English First Name: " & line3
set line4 = objControls("Eng.lName")
strBody = strBody & vbCrLf & " English Last Name: " & line4
set line5 = objControls("JobTitle")
strBody = strBody & vbCrLf & " Job Title: " & line5
set line6 = objControls("telnum")
strBody = strBody & vbCrLf & " Phone: " & line6
set line7 = objControls("dirmanager")
strBody = strBody & vbCrLf & " Direct Manager: " & line7
set line8 = objControls("pernotes")
strBody = strBody & vbCrLf & " Notes: " & line8
.BodyFormat = olFormatPlain
.Body = strBody
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function

========== end of code ==============




Sue Mosher [MVP-Outlook] July 2nd 07 03:50 PM

outlook forms scripts
 
In Outlook 2000, you can call Item.Close 1 to close and discard the current item. It will probably give you errors in Outook 2003, though, because of a bug.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"אמיר מצס" wrote in message ...
most outlook 2003 and several outlook 2000


thanks for your answer...
I have a nother one.

I used the folowing code (some from you and some from someone else) to send
my plain form...

at the send command it gives you a message box that email was send and you
can close the original mail.

Is there any way to close it automaticly??

thanks

amir

=========== the code I used =========
Function Item_Send()
Dim objMsg ' As Outlook.MailItem
Dim objRecip ' As Outlook.Recipient
Dim objNewRecip ' As Outlook.Recipient
Const olMailItem = 0
Const olFormatPlain = 1
On Error Resume Next
Item_Send = False
Set objMsg = Application.CreateItem(olMailItem)
For Each objRecip In Item.Recipients
Set objNewRecip = _
objMsg.Recipients.Add(objRecip.address)
If objNewRecip.Resolve Then
objNewRecip.Type = objRecip.Type
End If
Next
If Item.Attachments.Count 0 Then
' Add CopyAtts function from
' http://www.outlookcode.com/d/code/copyatts.htm
' to this script.
Call CopyAtts(Item, objMsg)
End If
With objMsg
Set objControls = Item.GetInspector.ModifiedFormPages("Message").Con trols
Set line1 = objControls("HebFName")
strBody = strBody & vbCrLf & " Hebrew First Name: " & line1
set line2 = objControls("Heb.lName")
strBody = strBody & vbCrLf & " Hebrew Last Name: " & line2
set line3 = objControls("Eng.fName")
strBody = strBody & vbCrLf & " English First Name: " & line3
set line4 = objControls("Eng.lName")
strBody = strBody & vbCrLf & " English Last Name: " & line4
set line5 = objControls("JobTitle")
strBody = strBody & vbCrLf & " Job Title: " & line5
set line6 = objControls("telnum")
strBody = strBody & vbCrLf & " Phone: " & line6
set line7 = objControls("dirmanager")
strBody = strBody & vbCrLf & " Direct Manager: " & line7
set line8 = objControls("pernotes")
strBody = strBody & vbCrLf & " Notes: " & line8
.BodyFormat = olFormatPlain
.Body = strBody
.DeferredDeliveryTime = Item.DeferredDeliveryTime
.DeleteAfterSubmit = Item.DeleteAfterSubmit
.ExpiryTime = Item.ExpiryTime
.Importance = Item.Importance
.OriginatorDeliveryReportRequested = _
Item.OriginatorDeliveryReportRequested
.ReadReceiptRequested = _
Item.ReadReceiptRequested
.Subject = Item.Subject
If .Recipients.count 0 _
And .Recipients.ResolveAll Then
.Send
MsgBox "Message sent successfully. " & _
"You can close the original now."
Else
.Display
End If
End With
Set objMsg = Nothing
Set objRecip = Nothing
Set objNewRecip = Nothing
End Function

========== end of code ==============





All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2006 OutlookBanter.com