Workbooks.Open parameters in XL2000 and XL2002

G

Guest

Hi,

I'm using C# and creating a wrapper class for Excel. On my laptop, I have Office 2000 installed and on my "normal" computer, I use Office 2002 (XP).

Now, the Workbooks.Open method takes a different number of parameters in both versions. In XL2000, it takes 1 necessary parameter and 12 optionnal ones (13 in all) while XL2002 takes 1 necessary parameter and 14 optionnal ones (15 in all).

Since, in C#, you cannot not specify an optionnal parameter and must use 'Missing.Value' instead, I'm kinda stuck. Of course, I'd like to write some code that will successfully compile AND run under both circumstances. Is that possible?

Any suggestions are welcomed.

SC
 
P

Philip Rieck

Although I prefer to code in C# over VB.NET, my advice on this one is : Do
it in VB.NET - really. Probably with Option Strict Off as well (gah! I
hate to say it!).

Doing Office interop or VSTO coding with C# is a big pain in the rear,
rivaled only by trying to do the same with c++. This is where .net is
nice, though -- isolate your office interactions to one assembly or (module)
and code that in vb.net. Do the rest in c#



SC said:
Hi,

I'm using C# and creating a wrapper class for Excel. On my laptop, I have
Office 2000 installed and on my "normal" computer, I use Office 2002 (XP).
Now, the Workbooks.Open method takes a different number of parameters in
both versions. In XL2000, it takes 1 necessary parameter and 12 optionnal
ones (13 in all) while XL2002 takes 1 necessary parameter and 14 optionnal
ones (15 in all).
Since, in C#, you cannot not specify an optionnal parameter and must use
'Missing.Value' instead, I'm kinda stuck. Of course, I'd like to write some
code that will successfully compile AND run under both circumstances. Is
that possible?
 

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