"Path/File Access Error" on Sheets.Copy

  • Thread starter Thread starter Nick Cranham
  • Start date Start date
N

Nick Cranham

After searching Google, despite many post started about this error
occurring, I could not find any explanation or solution, so I'll try again.
This runs fine sometimes, but can then error for some unknown reason. A
restart of Excel, log off/log on, Windows can make a difference, but not
always.
Certainly only 1 instance of Excel running.
File name or path may have Chinese in it, but I don't think that's the
cause.

--------- Code -----------------------
Dim WBSpecs As Workbook

On Error GoTo cmdGetWS_Click_Error

Response = Excel.Application.GetOpenFileName("HK Spec Files (*.xls), *.xls",
, "Select the Spec Sheet to cost.")
If Response <> False Then

Set WBSpecs = Workbooks.Open(Response)
With WBSpecs
.Sheets(1).Copy Before:=ThisWorkbook.Sheets("Costings")
.Sheets(2).Copy Before:=ThisWorkbook.Sheets("Costings")
.Close False
End With

Set WBSpecs = Nothing
--------- Code -----------------------

It bombs on ".Sheets(1).Copy Before..." with the error msg "Path/File Access
Error" '.\VBxx.tmp'".
Watching the folder containing the open workbook, the file VBxx.tmp is only
created after the error box appears.
Error handler on, so how is this error generating it's own unhandled error ?

Any help greatly appreciated.

NickHK
 
I wonder if it is because of slow server response to the creation of th
.tmp file.

Try adding a delay of a second or two into the code :-
Application.Wait Now + TimeValue("00:00:02") ' =2 second
 
BrianB,
Thanks for the input, but it does seem to connected with opening the file
from a path that contains Chinese characters, on the network (running W2K
Chinese) or my computer (running W2K English). Chinese characters in the
file name do not cause a problem.
I can open the file no problem and .Save, but .SaveAs and Sheets.Copy (and
possibly other methods) error.
The temp file that's created (in the folder of the opened file) upon failure
is always zero bytes.

NickHK
 
Nick
I have a similar problem...were you able to find the cause of error ...and solution for that. I would appreciate if you could share that . An email will be appreciated : (e-mail address removed)

Thanks
Aji
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top