Witam,
chce eksportować liste kontaktowy z exela do outloka ale wyskakuje mi dziwny blad.
Moze ktoś wie jak przerobić Excela aby widział go outlook
w danym pliku excel sa nastepujace kategorie
FIRMA, NAZWA, MIASTO, ADRES EMAIL, KATEGORIA
Moderator: Moderatorzy
Sub Export_PAB_to_vcfs()
Dim myOlApp As Outlook.Application
Dim objContact As ContactItem
Set myOlApp = New Outlook.Application
Set olns = myOlApp.GetNamespace("MAPI")
' Set MyFolder to the default contacts folder.
Set myFolder1 = olns.Folders("Foldery osobiste")
Set myFolder = myFolder1.Folders("Kontakty")
' Get the number of items in the folder.
NumItems = myFolder.Items.Count
' Loop through all of the items in the folder.
For i = 1 To NumItems
Set objContact = myFolder.Items(i)
If Not TypeName(objContact) = "Nothing" Then
If Not objContact.FullName = "" Then
strName = "C:\kontakty\" & objContact.FullName & ".vcf"
objContact.SaveAs strName, olVCard
End If
End If
Next
MsgBox "Gotowe"
End Sub
Sub Export_PAB_to_vcfs()
Dim myOlApp As Outlook.Application
Dim objContact As ContactItem
Dim olNs As NameSpace
Dim NumItems As Long, i As Long, strName As String
Dim myFolder As MAPIFolder
Set myOlApp = New Outlook.Application
Set olNs = myOlApp.GetNamespace("MAPI")
Dim bExitFor: bExitFor = False
Do
Set myFolder = Application.GetNamespace("MAPI").PickFolder
If myFolder Is Nothing Then
Exit Sub
End If
If myFolder.DefaultMessageClass <> "IPM.Contact" Then
MsgBox "Wpisanie inf do folderu ''" & myFolder.Name & "'' nie jest możliwe." & vbCr _
& "Wybierz folder kontaktow!", vbExclamation, " Informacja o błędzie"
Set myFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Else
bExitFor = True
End If
Loop While Not bExitFor
Set myFolder = Application.GetNamespace("MAPI").GetFolderFromID(myFolder.EntryID, myFolder.StoreID)
NumItems = myFolder.Items.Count
On Error Resume Next
MkDir "c:\kontakty"
For i = 1 To NumItems
DoEvents
Set objContact = myFolder.Items(i)
If Not TypeName(objContact) = "Nothing" Then
If Not objContact.FullName = "" Then
strName = "C:\kontakty\" & objContact.FullName & ".vcf"
objContact.SaveAs strName, olVCard
End If
End If
Next
Set myOlApp = Nothing
Set olNs = Nothing
Set myFolder = Nothing
MsgBox "Gotowe"
End Sub
Użytkownicy przeglądający ten dział: Bing [Bot] i 4 gości