2011-07-15 14 views
0

私はVBについて何も知りません。 「添付ファイル」という言葉がメッセージ本文に記載されている場合、リマインダーをポップアップする次のコードがあります。メッセージに添付ファイルが含まれていて、メッセージを安全に(暗号化して)送信する必要があるかどうかを尋ねるメッセージが表示されます。セキュリティを送信するOutlook添付ファイルのVBコード

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 
‘ Pops up a reminder if the word “attach” is found but there is no attachment on your email. 
Dim m As Variant 
Dim strBody As String 
Dim intIn As Long 
Dim intAttachCount As Integer, intStandardAttachCount As Integer 

On Error GoTo handleError 

‘Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature. 
intStandardAttachCount = 0 

strBody = LCase(Item.Body) 

intIn = InStr(1, strBody, “original message”) 

If intIn = 0 Then intIn = Len(strBody) 

intIn = InStr(1, Left(strBody, intIn), “attachment”) 

intAttachCount = Item.Attachments.Count 

If intIn > 0 And intAttachCount <= intStandardAttachCount Then 

m = MsgBox(“It appears that you mean to send an attachment,” & vbCrLf & “but there is no attachment to this message.” & vbCrLf & vbCrLf & “Do you still want to send?”, vbQuestion + vbYesNo + vbMsgBoxSetForeground) 

If m = vbNo Then Cancel = True 

End If 

handleError: 

If Err.Number <> 0 Then 
MsgBox “Outlook Attachment Reminder Error: ” & Err.Description, vbExclamation, “Outlook Attachment Reminder Error” 
End If 

End Sub 
+0

そして、あなたの質問はありますか? – JohnFx

+0

私はvbについて何も知らないので、コードを編集する手助けができますか? – Mihn

+0

あなたのコードは書かれません。あなたはVBAを学ぶべきです。 – SLaks

答えて

0

私はこれをコメントとして投稿したいと思いましたが、それほど多くの文字をサポートしませんでした。

SLaksあなたはVBAを学ぶべきであると言って正しいです:)

2つの主な利点:

1)あなたは新しい言語

2を学ぶ)明日君場合あなたが再び助けを求めるのではなく、自分で編集することができます。これはまた、あなたが解決のために無限の時間を待つ必要がないことを保証するでしょう

私は、.Subject.Bodyの単語 "添付ファイル"をチェックするDan Evansによって最初に書かれたと信じています。電子メールは上記のとおり、別の目的を果たします。

ご質問は下記をご覧ください。

ヒント

上記した後、あなたのコードに示すように、単にメッセージを暗号化添付ファイルがあるかどうかを確認するためにitem.Attachments.Countを使用してください。

注意

添付ファイルを暗号化すると、単純なプロセスではありません。通常のVBAコードよりも若干進んでいます。 )

あなたがひどい場合は、試したコードを投稿してください。私たちは間違いなくあなたを助けます(つまり、言語を学ぶ努力を示している場合)。

HTH

シド

関連する問題