Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OfficeXP PIA compatibility

If I write code against the OfficeXP PIA, will my application run in
Office2003? Currently, we have applications that were written in COM
against the Window 2000 object model. Once we install the app into OfficeXP
or Office2003, it will work correctly because these object models seems to
have backward compatibility between versions. I want to know if the PIA for
..NET is the same.

Thanks
Calvin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default OfficeXP PIA compatibility

Hi vincent,

PIA means Primary Interop Assembly which is used to help the solution developer to leverage all the new capabilities of the Microsoft .NET Framework
and to access Microsoft Office in a reliable and consistent way. The office object model from PIA is compatible within 10 and 11.

From my experience on this issue, please remember to deploy the app-related PIA version to the users' boxes. Therefore, if you develop one solution
with the office xp PIA, your application will call the office xp PIA assembly from GAC. The version of Office XP PIA is 10.0.4504.0. During runtime, the
application will try to find this version of PIA assembly from GAC and then load it. If it is not able to find it, it will report the FileNotFoundException
exception. Also then, if you develop the app with office 11, your application will need the 11 version of PIA to run. When you deploy the application
to users, you should firstly check the PIA version in the GAC so that you can deploy the app-related PIA to the destination. This is because CLR will
check the version of referenced assembly.

In another way, if you develop the solution with office XP, you can recompile it in the office 11 located box and will only need to change the PIA
reference to a newer version. In this way, your application can run with office 11 PIA without modifying the codes.

For more information on this Office XP PIA issue, I'd suggest two msdn articles that may help. Please go to:
A Primer to the Office XP Primary Interop Assemblies
http://msdn.microsoft.com/library/en...asp?frame=true

Primary Interop Assemblies (PIAs)
http://msdn.microsoft.com/library/en...asp?frame=true

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OfficeXP PIA compatibility

Mr. Wei-Dong,
I am running VB.Net on XP and try to program with
Office 2003 (Excel 2003).
The following is my first test program.
I installed the PIA through the Office 2003 upgrade by
checking the ".Net Programability Support". I Added
the "Microsoft Excel 11.0 Object Library" to the VB
project as Reference. I could see the Object in the
design view object dropdown box except the Excel.Range
(don't know why??). When I debug the code step by step,
it passed the first three object binding. But I got run
time error at the line

Dim objWB As New Microsoft.Office.Interop.Excel.Workbook

Here is the Error Msg
A first chance exception of
type 'System.Runtime.InteropServices.COMException'
occurred in TestExcel.exe

Additional information: COM object with CLSID {00020819-
0000-0000-C000-000000000046} is either not valid or not
registered.

I checked the registry, the COM object is there. I re-
install the Office Upgrade. The same error is encountered
at the same line of code.
Could you give me any clue for what is wrong and how
to solve this.
Thank you very much



------VB Code
Module TestExcel
Sub main()

Dim objWkSheet As New
Microsoft.Office.Interop.Excel.Worksheet
Dim objRolCol As New
Microsoft.Office.Interop.Excel.XlRowCol
Dim objApp As New
Microsoft.Office.Interop.Excel.Application
Dim objWB As New
Microsoft.Office.Interop.Excel.Workbook
''Dim objRange As New
Microsoft.Office.Interop.Excel.

objWB = objApp.Workbooks.Open
("C:\VBCode\TestData\WRDS_Test\Test Data 1.xls")
objWkSheet = objWB.Worksheets.Item(0)
objRolCol = objWkSheet.Cells(1, 1)
MsgBox("Cell1_1:" + objRolCol.ToString())

objWB.Close()
objApp.Quit()
objRolCol = Nothing
objWkSheet = Nothing
objWB = Nothing
objApp = Nothing


End Sub



End Module


-----Original Message-----
Hi vincent,

PIA means Primary Interop Assembly which is used to help

the solution developer to leverage all the new
capabilities of the Microsoft .NET Framework
and to access Microsoft Office in a reliable and

consistent way. The office object model from PIA is
compatible within 10 and 11.

From my experience on this issue, please remember to

deploy the app-related PIA version to the users' boxes.
Therefore, if you develop one solution
with the office xp PIA, your application will call the

office xp PIA assembly from GAC. The version of Office XP
PIA is 10.0.4504.0. During runtime, the
application will try to find this version of PIA

assembly from GAC and then load it. If it is not able to
find it, it will report the FileNotFoundException
exception. Also then, if you develop the app with office

11, your application will need the 11 version of PIA to
run. When you deploy the application
to users, you should firstly check the PIA version in

the GAC so that you can deploy the app-related PIA to the
destination. This is because CLR will
check the version of referenced assembly.

In another way, if you develop the solution with office

XP, you can recompile it in the office 11 located box and
will only need to change the PIA
reference to a newer version. In this way, your

application can run with office 11 PIA without modifying
the codes.

For more information on this Office XP PIA issue, I'd

suggest two msdn articles that may help. Please go to:
A Primer to the Office XP Primary Interop Assemblies
http://msdn.microsoft.com/library/en-

us/dnofftalk/html/office10032002.asp?frame=true

Primary Interop Assemblies (PIAs)
http://msdn.microsoft.com/library/en-

us/dndotnet/html/whypriinterop.asp?frame=true

Please feel free to let me know if you have any further

questions.

Does this answer your question? Thank you for using

Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and

confers no rights.


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default OfficeXP PIA compatibility

Hi Carol,

Thank you for replying and more information regarding your scenario!

With the help of office PIA, we can develop office solution in .Net. however, Office PIA just takes advantage of .net and com interop to cross the
boundary of .net ( managed code ) and com component ( belongs to un-managed code ). The runtime-callable wrapper builds the communication
between .net and com. This is to say, we still need to follow the old office development restriction.

After checking your codes, I found that you use new keyword to create some objects which is not supported by the Office object. We can't create
one new workbook. This is the reason why runtime throws error to you. There is one KB article which illustrates how to automate Excel in VB.net. I
think this kb artile will help you a lot on this issue. Please go to:
301982 HOWTO: Automate Microsoft Excel from Visual Basic .NET
http://support.microsoft.com/?id=301982

For the Range object, I'd suggest you will find it from Visual Studio.Net object viewer. You can run it from "View-Object viewer" in visual studio or
press "Ctrl+Atl+J". Then in the namespace Microsoft.Office.Interop.Office, you will find the range interface from there.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default OfficeXP PIA compatibility

Hi,
I am using VB.NET 2003 and try to program using Excel
2003 (Office 2003 Upgrade) on XP. I installed the PIA
through the Office 2003 by checing the ".Net
Programability Support". In the VB project , I added
the "Microsoft Excel 11.0 Object Library".
The following is my first test code. I have two
problems.
1. In the design view, I could see the
Excel.Application,Excel.Workbook,Excel.WorkSheet etc. But
I could not see the Excel.Range object in the dropdown
box.
2. When I debug the code step by step, it passed the
first three object declaration lines. But, I got run time
error at the line
Dim objWB As New Microsoft.Office.Interop.Excel.Workbook
The error messag is
A first chance exception of
type 'System.Runtime.InteropServices.COMException'
occurred in TestExcel.exe

Additional information: COM object with CLSID {00020819-
0000-0000-C000-000000000046} is either not valid or not
registered.

I checked the Registry, the COM object with this
CLSID is there. I even re-installed the Office 2003 and
PIA several time. I still get the same error at the same
place.
Here is the PIA info I got from GAC (gacutil /l ...)

Microsoft (R) .NET Global Assembly Cache Utility.
Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights
reserved.

The Global Assembly Cache contains the following
assemblies:
Microsoft.office.Interop.Excel, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c,
Custom=null

The cache of ngen files contains the following entries:

Number of items = 1

Do you have have any clue to solve this??

Thank you for your help!

Carol

---------------VB Code ----------------
Module TestExcel
Sub main()

Dim objWkSheet As New
Microsoft.Office.Interop.Excel.Worksheet
Dim objRolCol As New
Microsoft.Office.Interop.Excel.XlRowCol
Dim objApp As New
Microsoft.Office.Interop.Excel.Application
Dim objWB As New
Microsoft.Office.Interop.Excel.Workbook
''Dim objRange As New
Microsoft.Office.Interop.Excel.

objWB = objApp.Workbooks.Open
("C:\VBCode\TestData\WRDS_Test\Test Data 1.xls")
objWkSheet = objWB.Worksheets.Item(0)
objRolCol = objWkSheet.Cells(1, 1)
MsgBox("Cell1_1:" + objRolCol.ToString())

objWB.Close()
objApp.Quit()
objRolCol = Nothing
objWkSheet = Nothing
objWB = Nothing
objApp = Nothing


End Sub



End Module

-----Original Message-----
Hi vincent,

PIA means Primary Interop Assembly which is used to help

the solution developer to leverage all the new
capabilities of the Microsoft .NET Framework
and to access Microsoft Office in a reliable and

consistent way. The office object model from PIA is
compatible within 10 and 11.

From my experience on this issue, please remember to

deploy the app-related PIA version to the users' boxes.
Therefore, if you develop one solution
with the office xp PIA, your application will call the

office xp PIA assembly from GAC. The version of Office XP
PIA is 10.0.4504.0. During runtime, the
application will try to find this version of PIA

assembly from GAC and then load it. If it is not able to
find it, it will report the FileNotFoundException
exception. Also then, if you develop the app with office

11, your application will need the 11 version of PIA to
run. When you deploy the application
to users, you should firstly check the PIA version in

the GAC so that you can deploy the app-related PIA to the
destination. This is because CLR will
check the version of referenced assembly.

In another way, if you develop the solution with office

XP, you can recompile it in the office 11 located box and
will only need to change the PIA
reference to a newer version. In this way, your

application can run with office 11 PIA without modifying
the codes.

For more information on this Office XP PIA issue, I'd

suggest two msdn articles that may help. Please go to:
A Primer to the Office XP Primary Interop Assemblies
http://msdn.microsoft.com/library/en-

us/dnofftalk/html/office10032002.asp?frame=true

Primary Interop Assemblies (PIAs)
http://msdn.microsoft.com/library/en-

us/dndotnet/html/whypriinterop.asp?frame=true

Please feel free to let me know if you have any further

questions.

Does this answer your question? Thank you for using

Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and

confers no rights.


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default OfficeXP PIA compatibility

Hi Carol,

Thank you for replying!

Please check my reply above. If you reference the excel.dll into your project in Visual Basic 2003. I'd suggest you can check the Range interface in
the object browser. For your runtime error, you should follow the Office development model. You can't new each object, for example the workbook
object. I have suggested one kb article for you on my reply above. You can obtain enough information to start the development of your .net solution
for excel.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing Reverse Compatibility and Compatibility in General dim Excel Discussion (Misc queries) 4 January 8th 08 01:02 PM
OfficeXP 2002 / Excel Mario Excel Discussion (Misc queries) 1 November 1st 05 09:26 PM
OfficeXP 2002 / Excel....Problems with emailing. Mario Excel Discussion (Misc queries) 0 November 1st 05 09:26 PM
MS OfficeXP Professional Herman Excel Discussion (Misc queries) 7 April 24th 05 04:38 PM
OfficeXP locations of macros, add-ins, etc? lost coming from Office97 Keith R[_3_] Excel Programming 1 September 17th 03 05:34 PM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"