Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble Using File System Object

Status
Not open for further replies.

sgfromny

Technical User
Jan 17, 2003
120
0
0
US
Im trying to copy files in Excel and I keep getting Access Denied to the Files.. I dont have them open else where so Im confused why I'd be getting this.. Is there a work around?
 
The Code is long - Here's the upper section.

Private Sub fetch_Click()
Dim FSO As FileSystemObject
Dim DocPath As String
Set FSO = CreateObject("Scripting.FileSystemObject")

DocPath = ThisWorkbook.Worksheets("Sheet1").Range("A101").Value
vJobNo = ThisWorkbook.Worksheets("Sheet1").Range("A100").Value
vLibraryPath = "c:\library\03 Desk\Assemblies"

'Single Base Frame
If Me.obBase1 = True Then
FSO.CopyFile vLibraryPath & "\Base Frames\Single\Base Frame Assembly.iam", vJobNo & "\Base Frame"
FSO.CopyFile vLibraryPath & "\Base Frames\Single\Base Frame Assembly.idw", DocPath
FSO.CopyFolder vLibraryPath & "\Base Frames\Single\Variable Components", vJobNo & "\Base Frame"
End If

'Double Base Frame
If Me.obBase1 = True Then
FSO.CopyFile vLibraryPath & "\Base Frames\Double\dbl Base Frame Assembly.iam", vJobNo & "\Base Frame"
FSO.CopyFile vLibraryPath & "\Base Frames\Double\Dbl Base Frame Assembly.idw", DocPath
FSO.CopyFolder vLibraryPath & "\Base Frames\Double\Variable Components", vJobNo & "\Base Frame"
End If
 
Make sure you have all the proper "\" in your variables and values.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top