-
Solved: openfiledialog run-time error 75 path/file Access Error
Hi,
I'm trying to copy files selected in the openfiledialog to c:\Rawdata.
The code below causes the Run-time error 75.
Public Sub GetFiles()
Dim fDialog As Office.FileDialog
Dim fso As New FileSystemObject
Dim Path As String
Dim Filename As String
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = True
.Title = "Please select one or more files"
.Filters.Clear
.Filters.Add "CSM Files", "*.TXT"
Path = "C:\RawData"
If .Show = True Then
For Each varFile In .SelectedItems
Filename = varFile
FileCopy varFile, Path
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
From what i've read on-line the error relates to permisions or lack of source file. The file clearly exists and I can copy and paste the file to the destination directory from within the open file dialog window so I can't see a permissions issue. I'm very new to VBA, and I'm probably missing something that should be obvious.
Any advice much appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules