View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jialiang Ge [MSFT] Jialiang Ge [MSFT] is offline
external usenet poster
 
Posts: 118
Default .NET Win Forms Application to Excel 2002, Excel 2003, and Excel 20

Hello George,

Welcome to Microsoft Managed Newsgroup Support Service! My name is Jialiang
Ge, from Microsoft Managed Newsgroup support team.

From your post, my understanding on this issue is: you wonder how to write
automation clients in C# or VB.NET for multiple Office versions (e.g. Excel
2002, 2003, 2007), so that our client application (the winform) can
supports users who might have one of the 3 different version of Office. If
I'm off base, please feel free to let me know.

According to the KB article http://support.microsoft.com/kb/244167/EN-US/,
there are two approaches that we can accomplish the task:

1. If we are using "early binding", namely, directly referencing an Office
interop assembly in the application, we can reference the interop assembly
of the earliest version of the Office application we intend to automate.
This is called "backward compatibility". In this case, we can reference
"Microsoft Excel 10.0 Object Library" which is for Excel 2002. One drawback
of this approach is that it does not allow our automation client to use
functionality in a new version of Office (e.g. the new function "Export to
PDF" which is only available to Office 2007). If we do need to use
functionality in a newer version of Office, but we are developing a project
that must work on systems that contain more than one version, we should use
late binding to make the call (see approach 2).

2. We can use late binding. If we intend to use Late binding, I'd
personally suggest writing code with VB.NET. VB.NET provides a much easier
interface for late binding than C#.

For more details about the two approaches, please read the KB article
http://support.microsoft.com/kb/244167/EN-US/.
About early binding and late binding, we can refer to
http://support.microsoft.com/kb/245115/

Please let me know if you have any other concerns, or need anything else. I
will be more than happy to be of assistance.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.