Delphi如何呼叫VBS |
尚未結案
|
terrychen
尊榮會員 發表:90 回覆:794 積分:501 註冊:2003-05-01 發送簡訊給我 |
|
terrychen
尊榮會員 發表:90 回覆:794 積分:501 註冊:2003-05-01 發送簡訊給我 |
小弟使用另一ㄍ方法
procedure TForm2.SendMail; var Outlook: variant;{ Application } OutlookNameSpace: variant;{ NameSpace } OutlookFolder: variant;{ MAPIFolder } OutlookMailItem: variant;{ MailItem } OutlookRecipient,OutlookReciepientItem: variant;{ Recipient } OutlookAttachment: variant;{ Attachment } begin try Outlook:=CreateOleObject('Outlook.Application'); except ShowMessage('無法?動Microsoft Outlook!'); Exit; end; try OutlookNameSpace := Outlook.GetNamespace('MAPI'); { 創建新郵件消息 } // OutlookFolder := OutlookNameSpace.GetDefaultFolder(olFolderOutbox); //增加收件人若地址薄中已有此人,則僅用其名字即可,否則必須包括完整地址,如OutlookNameSpace.CurrentUser.Address} OutlookMailItem := OutlookFolder.Items.Add(olMailItem); OutlookRecipient := OutlookMailItem.Recipients.Add('ZhangChunming'); OutlookRecipient.Type := olTo; if not OutlookRecipient.Resolve then begin ShowMessage('無法解析地址!'); Exit; end; { 插入附件(確保路徑正確) } OutlookAttachment := OutlookMailItem.Attachments.Add('c:\1120.XLS'); OutlookAttachment.DisplayName := '樣本附件'; { 設置郵件主題、郵件正文和重要性 } OutlookMailItem.Subject := '郵件主題'; OutlookMailItem.Body := '此處?郵件內容'; OutlookMailItem.Importance := olImportanceHigh; OutlookMailItem.Send; Showmessage('郵件已送出'); finally OutlookRecipient := Unassigned; OutlookAttachment := Unassigned; OutlookMailItem := Unassigned; OutlookFolder := Unassigned; OutlookNameSpace := Unassigned; Outlook := Unassigned; end; end;是由jackkcg兄所發表 執行沒出現錯誤,但似乎郵件也沒有寄出 試了好久,請各位前輩指點一下 P.S小弟使用的是D6不知跟版本有無關係 發表人 - Terrychen 於 2003/11/24 10:57:29 |
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
|
terrychen
尊榮會員 發表:90 回覆:794 積分:501 註冊:2003-05-01 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |