OUTLOOK2007 use macros to bulk import VCF files as Contacts _each

Source: Internet
Author: User

Sub Opensavevcard ()

rem Batch file Rename (remove "_" and spaces in filename)
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
StrName = Replace (Strvcname, "_", "")
StrName = Replace (StrName, "", "")
Name Strvcname as StrName
Next
End Sub


Sub OpenSaveVCard1 ()

REM Bulk Import
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.