checke om en folder i outlook eksistere
Jeg har følgende kode:Dim OutL As New Outlook.Application
Dim OutLCon As Outlook.ContactItem
Dim OutName As Outlook.NameSpace
Dim OutFolder As Outlook.MAPIFolder
Dim OutNewFolder As Outlook.MAPIFolder
Dim OutOldFolder As Outlook.MAPIFolder
Dim StrFileName As String
Dim Fs As New FileSystemObject
Dim StrContacts() As String
Dim StrInput As String
StrFileName = "c:\temp\conout.pst"
If Fs.FileExists(StrFileName) Then
Set OutName = OutL.GetNamespace("MAPI")
Set OutFolder = OutName.GetDefaultFolder(olFolderContacts)
Set OutOldFolder = OutFolder.Folders("Testfolder")
OutOldFolder.Delete
Set OutNewFolder = OutFolder.Folders.Add("Testfolder")
Open StrFileName For Input As #1
Do While Not EOF(1)
Line Input #1, StrInput
StrContacts = Split(StrInput, ";")
Set OutLCon = OutNewFolder.Items.Add
LblStatus.Caption = "Updating....: " & StrContacts(0) & " " & StrContacts(1)
With OutLCon
.Account = StrContacts(0)
.FirstName = StrContacts(1)
.NickName = "bst"
.BusinessTelephoneNumber = StrContacts(8)
.Email1Address = StrContacts(6)
.Save
End With
Loop
OutLCon.Close olSave
Set OutLCon = Nothing
Close #1
End If
spørgsmålet går på at, der hvor jeg sletter en folder for derefter at tilføje den igen. Kan jeg ikke checke om den er der?
ala floder.exists(strnavn) eller ligende ???
