0

Hello,

I have been using StreamWriters for a long and time and it has always worked but now I seem to be getting an Access Denied error while trying to save to the current users Desktop...

Dim savePath As String = "C:\Users\Josh\Desktop\EpiPhone\029.csv"
Using sw As New StreamWriter(savePath)
    '...Rest of code...
End Using

What are the most common problems with Access Denied while writing to the Desktop?

4
Contributors
4
Replies
17
Views
4 Years
Discussion Span
Last Post by Jamblaster
0

The only thing that comes to mind is that you are not actually using the current user's name. Try using

Dim savePath As String = "%USERPROFILE%\Desktop\EpiPhone\029.csv"
0

I am definately using my username because if I go in File Explorer, click on desktop and copy the address path it says the exact same as the savePath String. I'll still check to see if your code works though, thanks for the suggestion.

0

To find the desktop you could use the my namespace.

My.Computer.FileSystem.SpecialDirectories.Desktop
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.