台灣最大程式設計社群網站
線上人數
918
 
會員總數:246087
討論主題:189663
歡迎您免費加入會員
討論區列表 >> ACCESS >> SaveAsOutlookContact當分割了資料庫後不能使用
[]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
SaveAsOutlookContact當分割了資料庫後不能使用
價值 : 10 QP  點閱數:181 回應數:1
樓主

Andy Si
門外漢
0 18
211 24
發送站內信

OnError
跳至 巨集名稱
巨集名稱 Beep
RunMenuCommand
指令 SaveAsOutlookContact
Submacro: Beep
Beep
End Submacro
---------------------------------------------
在資料庫未分割時, 是能正常使用, 當分割了資料庫後, 就不能使用, 沒有任何反應。請問各位老師,應該如何改動?





搜尋相關Tags的文章: [ SaveAsOutlookContact ] ,
本篇文章發表於2020-07-18 17:03
1樓
作者回應

Andy Si
檢舉此回應
Public Sub AddOlContact()
'Ref: https://docs.microsoft.com/en-us/office/vba/api/outlook.contactitem
On Error GoTo Error_Handler
#Const EarlyBind = False 'True = Use Early Binding
'False = Use Late Binding
#If EarlyBind = True Then
'Early Binding Declarations
'Requires Ref to Microsoft Outlook XX.X Object Library
Dim oOutlook As Outlook.Application
Dim olContact As Outlook.ContactItem
#Else
'Late Binding Declaration/Constants
Dim olApp As Object
Dim olContact As Object
Const olContactItem = 2
#End If

Set olApp = CreateObject("Outlook.Application")
Set olContact = olApp.CreateItem(olContactItem)

With olContact
.FirstName = "Daniel"
.LastName = "Alba"
.FullName = "Alba, Daniel"
.FileAs = "D. Alba"
.Anniversary = #7/22/1975#
.JobTitle = ""
.CompanyName = "MINI CARDA"
.BusinessAddressStreet = "22 ClearPoint"
.BusinessAddressCity = "Pointe-Claire"
.BusinessAddressState = "Quebec"
.BusinessAddressCountry = "Canada"
.BusinessAddressPostalCode = "H9X 3A6"
.BusinessTelephoneNumber = "(514) 488-0956"
.BusinessFaxNumber = ""
.Email1Address = "mini@mini.com"
.MobileTelephoneNumber = ""
.AddPicture ("C:\Users\ItsMe\Pictures\home-2955065_960_720.jpg")
.Save
'.Display 'Uncomment if you wish the user to see the contact pop-up
End With

Error_Handler_Exit:
On Error Resume Next
If Not olContact Is Nothing Then Set olContact = Nothing
If Not olApp Is Nothing Then Set olApp = Nothing
Exit Function

Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: AddOlContact" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Function
----------------------------請問各位老師, 上述應該如何應用?
本篇文章回覆於2020-07-20 17:52
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
   
1

回覆
如要回應,請先登入.