Re: File not found
- From: argusy <argusy@xxxxxxxxxxxxxxx>
- Date: Tue, 16 Jun 2009 23:47:36 +0930
Melvin wrote:
"Melvin" <marvwade@xxxxxxxxxxxxxxx> wrote in message news:%23ePvKCh7JHA.1416@xxxxxxxxxxxxxxxxxxxxxxxAnd, as Nobody pointed out, administrator permissions come into play with Vista, and recommend his usage of ENVIRON to set your target file"argusy" <argusy@xxxxxxxxxxxxxxx> wrote in message news:024448df$0$20662$c3e8da3@xxxxxxxxxxxxxxxxxxxxMelvin wrote:This is a follow-up to a previous post suggesting I use an API in downloading prices from the internet. I think this routine can be modified but I am hung up on the portion of the routine where is tries to open the sLocal file. If I run it as is I get Runtime error 75. I am not sure if the local file has to be created prior to running the process. If so, it the name of the folder actually "c:\deleteme.htm"? I have created a file with that name and extension in c: but when I try to run the routine I still get the file/path access error.
A copy of the routines is:
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Private Sub Command1_Click()
Dim sSourceUrl As String
Dim sLocalFile As String
Dim hfile As Long
sSourceUrl = "http://vbnet.mvps.org/code/faq/fileloadtext.htm"
sLocalFile = "c:\deleteme.htm"
If DownloadFile(sSourceUrl, sLocalFile) Then
hfile = FreeFile
Open sLocalFile For Input As #hfile
Debug.Print Input$(LOF(hfile), hfile)
Close #hfile
End If
End Sub
Public Function DownloadFile(sSourceUrl As String, sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, sSourceUrl, sLocalFile, _
BINDF_GETNEWESTVERSION, 0&) = ERROR_SUCCESS
End Function
Any assistance would be appreciated.
Mel
Hi, Mel
I dropped that code into a new project and it worked.
It didn't matter if the local file existed or not - your code created the local file or overwrote it.
Graham
Graham, now I am really confused. Since you found it to work I copied the exact code from my original message into a new project and I still get the error message "Run-time error '75': Path/File access error". I was careful to remove any file named "deleteme.htm" from drive C and also changed the source location to drive "J:\" sameerror results. I changed the file name for drives C and I - same results. I even moved the whole process to a different computer. Same results.
How can this be?
Mel
Correction.. The process DID work on another computer. Gad!!
Mel
I didn't think of that, as I have administrator privileges on an XP system
Graham
.
- References:
- File not found
- From: Melvin
- Re: File not found
- From: argusy
- Re: File not found
- From: Melvin
- Re: File not found
- From: Melvin
- File not found
- Prev by Date: Re: File not found
- Next by Date: Re: When the compiler freezes.... what is the rescue?
- Previous by thread: Re: File not found
- Next by thread: Re: File not found
- Index(es):
Relevant Pages
|