Results 1 to 4 of 4

Thread: Run-time error '75': path/file access error

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    4

    Run-time error '75': path/file access error

    So I tried to create a program that created a folder in the Windows directory and then copied a certain file to that newly created directory. I have accomplished this, oddly, on my computer only. When I send the program to others to use they receive this error:

    Code:
    [run-time error '75'....path/file access error]
    Anybody seem to know the problem?

    I will paste partial code if needed.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Run-time error '75': path/file access error

    might be you hard coded the windows path, they might be using win98 vs your xp or so.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    4

    Re: Run-time error '75': path/file access error

    Hmm, I don't think so.


    VB Code:
    1. Dim dirpath As String
    2. Dim SourceFile, DestinationFile
    3.  
    4.     'new folder call
    5.     dirpath = Trim(GetWindowsDirectory) & "\newfolder"
    6.  
    7.     'make the new folder
    8.     MkDir Trim(dirpath)
    9.  
    10.     'copy file to new folder
    11.     SourceFile = Trim(GetWindowsDirectory) & "\system32\drivers\etc\hosts"
    12.     DestinationFile = Trim(dirpath) & "\hosts"
    13.     FileCopy SourceFile, DestinationFile

    VB Code:
    1. Private Declare Function GetWindowsDirectoryB Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    2. Private Const MAX_LENGTH = 512
    3.  
    4. Public Function GetWindowsDirectory() As String
    5.    Dim s As String
    6.    Dim c As Long
    7.    s = String$(MAX_LENGTH, 0)
    8.    c = GetWindowsDirectoryB(s, MAX_LENGTH)
    9.    If c > 0 Then
    10.        If c > Len(s) Then
    11.            s = Space$(c + 1)
    12.            c = GetWindowsDirectoryB(s, MAX_LENGTH)
    13.        End If
    14.    End If
    15.    GetWindowsDirectory = IIf(c > 0, Left$(s, c), "")
    16. End Function

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Run-time error '75': path/file access error

    might help

    Dim dirpath As String
    Dim SourceFile, DestinationFile

    'new folder call
    dirpath = Trim(GetWindowsDirectory) & "\newfolder"

    'make the new folder
    If Dir(dirpath, vbDirectory) <> "" Then
    MkDir Trim(dirpath)
    end if


    'copy file to new folder
    SourceFile = Trim(GetWindowsDirectory) & "\system32\drivers\etc\hosts"
    DestinationFile = Trim(dirpath) & "\hosts"
    FileCopy SourceFile, DestinationFile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width