3
我正在將人們從舊電子郵件客戶端轉換到Outlook 2010.嘗試通過高效轉換聯繫人可能會很痛苦,所以我們有一些代碼可以幫助我們完成繁重的工作。我正在使用的過程很有用。我擁有來自聯繫人的所有VCards,並找到了一個導入所有這些VCards的宏的源代碼。問題是它默認爲「聯繫人」通訊簿。下面是代碼:Outlook 2010中的Visual Basic宏保存到特定的文件夾?
Sub OpenSaveVCard()
Dim objWSHShell As IWshRuntimeLibrary.IWshShell
Dim objOL As Outlook.Application
Dim colInsp As Outlook.Inspectors
Dim strVCName As String
Dim fso As Scripting.FileSystemObject
Dim fsDir As Scripting.Folder
Dim fsFile As Scripting.File
Dim vCounter As Integer
Set fso = New Scripting.FileSystemObject
Set fsDir = fso.GetFolder("C:\VCARDS")
For Each fsFile In fsDir.Files
strVCName = "C:\VCARDS\" & fsFile.Name
Set objOL = CreateObject("Outlook.Application")
Set colInsp = objOL.Inspectors
If colInsp.Count = 0 Then
Set objWSHShell = CreateObject("WScript.Shell")
objWSHShell.Run strVCName
Set colInsp = objOL.Inspectors
If Err = 0 Then
Do Until colInsp.Count = 1
DoEvents
Loop
colInsp.Item(1).CurrentItem.Save
colInsp.Item(1).Close olDiscard
Set colInsp = Nothing
Set objOL = Nothing
Set objWSHShell = Nothing
End If
End If
Next
End Sub
我不是太熟悉Visual Basic和編寫宏,有沒有辦法在那裏我可以指定的地址簿保存到?例如,如果我有一個名爲「測試」的地址簿。感謝您的任何幫助。