I found that I often need to synchronize the Gmail address book with the Outlook Address Book, and often I just want to update the user information of a certain category. The outlook menu only supports exporting all address book information as CSV files. When I want to output only one category (for example, "classmate. High School"), I need to first output it as an Excel table and then filter and convert it into a CSV file.It cannot be a great time.. I decided to use VBA to solve this problem.
Outlook is one of the office components. It supports VBA automation objects, but there are few books related to it. It can only be learned through Google's own exploration. The final script is as follows:
Sub ExportVCards () dim objNS As NameSpace 'namespace Dim objcontactfolder' address book directory Dim objEntry As Variant 'oem entry Dim objContactEntry As ContactItem 'address book entry Dim count As Integer 'counter Dim CategoriesName As string' category exportFolder As String 'output directory CategoriesName = "students. middle School "ExportFolder =" e: \ temp \ contacts \ "count = 0 Set objNS = Application. getNamespace ("MAPI") 'is used to connect to the command space. This is the method Set objContactFolder = objNS to obtain the command handle when a macro is used in Outlook. getDefaultFolder (olFolderContacts) 'to the address book directory For Each objEntry In objContactFolder. items 'traverse the address book directory If Not TypeOf objEntry Is ContactItem Then If TypeOf objEntry Is DistListItem Then Debug. print "Found a distribution list, skipping" Else Debug. print "****** found a something odd *****" Debug. print "" & objEntry End If Else Set objContactEntry = objEntry If CategoriesName = objEntry. categories Then count = count + 1 path = ExportFolder & "contact" & count &". vcf "objContactEntry. saveAs path and olVCard output the entry to the directory. End If Next Set objNS = NothingEnd Sub
After the above Code, output all communication contact entries of this category to a single file, and then use the command to merge all files. The method I use is the cat command of cygwin, that is
cat contact*.vcf > all.vcf
After being imported to Gmail, use merge to integrate duplicate personnel.