J
jclark419
Hey everyone, the topic pretty much says what my problem is. I create
file then I think that I close it off correctly. I late come back an
delete the file and for whatever reason it says permission is denied.
Here is the code where I create the file:
Code
-------------------
Public Function fedit()
fname = UserForm1.ListBox1.Value
NameBox.Text = fname
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & fname & ".txt")
Set fed = f.openastextstream(1, 0)
Do While fed.AtEndOfStream <> True
highlight = fed.ReadLine
If highlight < 100 Then
ListBox1.Selected(highlight) = True
End If
Loop
fed.Close
Set fed = Nothing
Set f = Nothing
Set fs = Nothing
End Function
-------------------
Here is the code where I try and delete the file:
Code:
Code
-------------------
Private Sub EditProfile_Click()
original = UserForm1.ListBox1.Value
UserForm3.Show
Set fs = CreateObject("scripting.filesystemobject")
fs.deletefile ("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & original & ".txt")
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\placeholder.txt")
f.Name = original & ".txt"
End Sub
-------------------
The actual error is on this line:
Code:
Code
-------------------
fs.deletefile ("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & original & ".txt")
-------------------
Any and all input will be appreciated.
Thanks
~
file then I think that I close it off correctly. I late come back an
delete the file and for whatever reason it says permission is denied.
Here is the code where I create the file:
Code
-------------------
Public Function fedit()
fname = UserForm1.ListBox1.Value
NameBox.Text = fname
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & fname & ".txt")
Set fed = f.openastextstream(1, 0)
Do While fed.AtEndOfStream <> True
highlight = fed.ReadLine
If highlight < 100 Then
ListBox1.Selected(highlight) = True
End If
Loop
fed.Close
Set fed = Nothing
Set f = Nothing
Set fs = Nothing
End Function
-------------------
Here is the code where I try and delete the file:
Code:
Code
-------------------
Private Sub EditProfile_Click()
original = UserForm1.ListBox1.Value
UserForm3.Show
Set fs = CreateObject("scripting.filesystemobject")
fs.deletefile ("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & original & ".txt")
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\placeholder.txt")
f.Name = original & ".txt"
End Sub
-------------------
The actual error is on this line:
Code:
Code
-------------------
fs.deletefile ("C:\Documents and Settings\a2001822\Desktop\DatalinkExcel\" & original & ".txt")
-------------------
Any and all input will be appreciated.
Thanks
~