IFTHENELSE
Programmer
I am having trouble with some FileSystemObject. I continue to get permission denied '70' error. The file is not open the file, it is not read only so any other help would be appreciated. Below is the code I am having trouble with:
Dim ol, olns, objFolder
Dim j, Count, myNewFolder
Const ForAppending = 8, ForWriting = 2
j = 1
Set ol = CreateObject("Outlook.Application"
Set olns = ol.GetNamespace("MAPI"
Set objFolder = olns.GetDefaultFolder(folder)
myEntryID = objFolder.EntryID
Count = objFolder.Items.Count
Set myNewFolder = olns.GetFolderFromID(myEntryID)
Set fso = CreateObject("Scripting.FileSystemObject"
Set fn = fso.CreateTextFile("C:\junk\outlook.txt", True)
Do While j > 0
getOutlook = myNewFolder.Items(j).SenderName & "|" & myNewFolder.Items(j).ReceivedTime & "|" & myNewFolder.Items(j).Subject & "|" & Replace(Chr(13) & Chr(10), "", myNewFolder.Items(j).Body) & "|" & Chr(13) & Chr(10)
fn.WriteLine (getOutlook(folder))
fn.Close
'myNewFolder.Items(j).Attachments & "|" & myNewFolder.Items(j).Recipients & "|" & myNewFolder.Items(j).CC & "|" & myNewFolder.Items(j).BCC & "|" &
Set fn = fs
penTextFile("C:\junk\outlook.txt", ForAppending)
fn.Write (getOutlook(folder))
j = j + 1
Loop
fn.Close
Set ol = Nothing
Set olns = Nothing
Set objFolder = Nothing
Set myNewFolder = Nothing
Set fso = Nothing
Set fn = Nothing
Dim ol, olns, objFolder
Dim j, Count, myNewFolder
Const ForAppending = 8, ForWriting = 2
j = 1
Set ol = CreateObject("Outlook.Application"
Set olns = ol.GetNamespace("MAPI"
Set objFolder = olns.GetDefaultFolder(folder)
myEntryID = objFolder.EntryID
Count = objFolder.Items.Count
Set myNewFolder = olns.GetFolderFromID(myEntryID)
Set fso = CreateObject("Scripting.FileSystemObject"
Set fn = fso.CreateTextFile("C:\junk\outlook.txt", True)
Do While j > 0
getOutlook = myNewFolder.Items(j).SenderName & "|" & myNewFolder.Items(j).ReceivedTime & "|" & myNewFolder.Items(j).Subject & "|" & Replace(Chr(13) & Chr(10), "", myNewFolder.Items(j).Body) & "|" & Chr(13) & Chr(10)
fn.WriteLine (getOutlook(folder))
fn.Close
'myNewFolder.Items(j).Attachments & "|" & myNewFolder.Items(j).Recipients & "|" & myNewFolder.Items(j).CC & "|" & myNewFolder.Items(j).BCC & "|" &
Set fn = fs
fn.Write (getOutlook(folder))
j = j + 1
Loop
fn.Close
Set ol = Nothing
Set olns = Nothing
Set objFolder = Nothing
Set myNewFolder = Nothing
Set fso = Nothing
Set fn = Nothing