0% found this document useful (0 votes)
10 views1 page

Excel To VCF

The document contains a VBA script that creates a VCF (vCard) file from contact data stored in an Excel sheet. It reads names and phone numbers from specified rows and formats them into vCard entries before saving the output to a file named 'OutputVCF.VCF'. Upon completion, it displays a message box indicating the file's save location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Excel To VCF

The document contains a VBA script that creates a VCF (vCard) file from contact data stored in an Excel sheet. It reads names and phone numbers from specified rows and formats them into vCard entries before saving the output to a file named 'OutputVCF.VCF'. Upon completion, it displays a message box indicating the file's save location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sub Create_VCF()

'Open a File in Specific Path in Output or Append mode


Dim FileNum As Integer
Dim iRow As Double
iRow = 2
FileNum = FreeFile
OutFilePath = ThisWorkbook.Path & "\OutputVCF.VCF"
Open OutFilePath For Output As FileNum
'Loop through Excel Sheet each row and write it to VCF File
While VBA.Trim(Sheets("Sheet1").Cells(iRow, 1)) <> ""
FName = VBA.Trim(Sheets("Sheet1").Cells(iRow, 1))
LName = VBA.Trim(Sheets("Sheet1").Cells(iRow, 2))
PhNum = VBA.Trim(Sheets("Sheet1").Cells(iRow, 3))
Print #FileNum, "BEGIN:VCARD"
Print #FileNum, "VERSION:3.0"
Print #FileNum, "N:" & FName & ";" & LName & ";;;"
Print #FileNum, "FN:" & FName & " " & LName
Print #FileNum, "TEL;TYPE=CELL;TYPE=PREF:" & PhNum
Print #FileNum, "END:VCARD"
iRow = iRow + 1
Wend
'Close the File
Close #FileNum
MsgBox "Contacts Converted to Saved To: " & OutFilePath
End Sub

You might also like