View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default 1004 Error on Workbooks.Open when run from inside IE

Hi Ds,

Without seeing the preceding code, I would
suggest that you try replacing

Workbooks.Open ...


with something like:

xlApp. Workbooks.Open ...



---
Regards.
Norman


"DS" wrote in message
...
Morning all, and happy Wednesday.

Have a slightly bizarre one to ask you fine people about.

The following Workbooks.Open statement forms part of my code.

Workbooks.Open Filename:=TargetPath & TargetBook, Password:="xxx",
WriteResPassword:="xxxx"

where TargetPath & TargetBook are defined previously.

Now, when running this from within Excel itself, it works fine and opens
the
desired workbook.
When running from within IE, I get a 1004 ("Method 'Open' of Object
'Workbooks' Failed") - but only when running as part of the full macro. If
I
hit debug, it takes me to that line, and hitting F8 to re-run that line in
a
fit of frustration sees it work perfectly, and open the required workbook.

Me no understand. Please save what remains of my hair and tell me why this
is happening, and, more importantly, how the *flipping heck* to stop it!!

thanks in advance,