Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission Denied '70'

Status
Not open for further replies.

IFTHENELSE

Programmer
Jan 31, 2001
10
US
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 = fso_OpenTextFile("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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top