
Signature
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Hello.
You do not need VSTO (Microsoft.Office.Tools/Microsoft.VisualStudio.Tools
namespaces) at all to automate Excel.
Just use Office2003 PIA
(http://www.microsoft.com/downloads/details.aspx?FamilyID=3c9a983a-ac14-4125-8ba0
-d36d67e0f4ad&DisplayLang=en).
Apparently you already have PIA installed cause you mentioned
Microsoft.Office.Interop.Excel namespace.
To open existing XLS file:
Dim excelApp as Microsoft.Office.Interop.Excel.Application
excelApp = new Microsoft.Office.Interop.Excel.Application()
Dim workbook as Microsoft.Office.Interop.Excel.Workbook
Dim missing as Object
missing = Missing.Value
workbook = excelApp.Workbooks.Open("PATH_TO_XLS", missing, missing,
missing, missing, missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing)
To update data use Object Model of workbook:
Dim firstSheet as Microsoft.Office.Interop.Excel.Worksheet
firstSheet = workbook.Sheets(1)
firstSheet.Cells(1, 1).Value2 = "Set some text for Cell:1:1"
...etc
But be aware of the BUG when automating Excel without VSTO:
http://support.microsoft.com/?scid=kb%3Ben-us%3B320369&x=15&y=12
Good luck
Ivan
> Hi
>
[quoted text clipped - 22 lines]
>
> -Ole_Brun
Ole_Brun - 04 Mar 2008 06:59 GMT
Thanks a lot Ivan!
I will try what you are suggesting.
But then my question will be; is it possible to use VSTO from an external
application, or do you have to use it in an Excel project?
-Ole_Brun
> Hello.
>
[quoted text clipped - 58 lines]
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Signature
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Ivan A. Vasilyev - 04 Mar 2008 07:26 GMT
> But then my question will be; is it possible to use VSTO from an external
> application, or do you have to use it in an Excel project?
I think VSTO is not intended for use out of projects of specific types. I
mean application- and document-level extensions projects.
But some reuse of VSTO is possible. E.g. you could reuse
ExcelLocale1033Proxy class
(http://msdn2.microsoft.com/en-us/library/microsoft.office.tools.excel.excellocal
e1033proxy.aspx)
to work around Excel bug mentioned in previous post.
But any reuse of VSTO makes an deployment process heavier. I.e. you should
have VSTO installed on a deployment machine for your app to work.
Best regards.
Ivan.
Ole_Brun - 05 Mar 2008 07:50 GMT
Thank you Ivan!
Now things are more clear to me.
Cheers,
Ole_Brun
>> But then my question will be; is it possible to use VSTO from an
>> external
[quoted text clipped - 12 lines]
> Best regards.
> Ivan.

Signature
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
I missed the Office version you use and gave you wrong PIA url.
For Office 2007 it is better to use "native" PIAs. Here is the right url
http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c
-b864d8bfa513&DisplayLang=en
PS. But PIAs are backward compatible so it is possible to use earlier
version if you need to support different Office versions in your solution.
E.g. you could use Office 2003 PIA to build single solution supporitng both
Office 2003 and Office 2007.