Path/File Access Error

G

Geetha

Hi,

I get an Error message saying "Path/File Access Error" when i try
to create a new worksheet in a macro. The same macro works fine on my
machine, and we tested in 3-4 other machines. It fails only on a
particular machine. following is the code sample that causes the
problem.

Dim Sheet As Worksheet
Set Sheet = Sheets.Add(Type:=ThisWorkbook.Path & "\Report.xlt")

where Report.xlt is a template file that is stored in the same location
as the Excel file itself. Can anyone please help me figure out what
might be wrong. The code fails even when I create the worksheet without
using a template("Report.xlt). That is by using the following code

Dim Sheet As Worksheet
Set Sheet = Sheets.Add

Thanks.
Geetha
 
N

NickHK

Geetha,
I can't duplicate your error with a variety of bad paths etc.
What does ThisWorkbook.Path evaluate to ?
Something strange about the permissions on that folder ?

NickHK
 

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

Top