View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Josh Orfanakis Josh Orfanakis is offline
external usenet poster
 
Posts: 5
Default Workbook.Open failure

I have a bunch of Excel files which I need to open and make some
formatting changes for printing.

There are a handful for which the Open method is failing.
The error info from the exception has proven to be useless. For most
when I open the file by hand in Excel there are various dialogs that pop
up. I figured this must be the reason. There is one dialog asking about
whether or not to enable/disable macros. There is one suggesting I open
read-only unless I need to make changes and lastly there are few that
pop up a password box.

The password ones are no problem. I understand the failure.

But what about the others? I tried setting EnableEvents to false and
DisplayAlerts to false but this did not make a difference.

I am using the COM interface to Excel 2000. I have been able to
translate most VB examples to my C++ but it is possible the
DisplayAlerts is not quite correct. The DisplayAlerts property is an
array of VARIANT_BOOL. The PutDisplayAlerts method takes a long lcid and
a VARIANT_BOOL. I am guessing lcid is an index. Which indices should I
set? Right now I am just guessing at 0. The GetDisplayAlerts just
returns VARIANT_BOOL. Huh?

Is there documentation on these methods anywhere? I am using C++ but I
do have VS.NET so I should have access to VB for reference. VB is not an
option for the application as this is only a part of a much larger C++
application.

Basically what I want to do is open the file with no user interaction,
select all rows/columns and call autofit, change all background to white
text to black and that is it. I need as little user interaction as
possible, like zero if possible.


Any help appreciated
TIA

JO