J
John Brock
I may have botched an install of Office Professional 2007, or I
may have a different problem. I hope someone will be able to tell
me which, and if the problem was the install, give me some advice
about reinstalling and getting it right.
What I want to do is use Visual Studio to write a VB.NET app that
reads and writes Excel workbooks. I have already done this in a
corporate setting (using VS 2005 Team Edition), but now I need to
do it on my home computer. In the corporate setting, if I wanted
the code in a module or class to be able to access Excel, I inserted
the following statement at the beginning of the file:
Imports Excel = Microsoft.Office.Interop.Excel
This didn't work at home, where I was using Excel 2002 and Visual
Studio 2008 Express. With a little research I found I needed these
things called PIAs (Primary Interop Assemblies), that came with
Office 2003 and 2007, but were not installed by default:
Office 2003 and later versions of Office include PIAs with
the Office Setup program. The Office PIAs may be installed
with the Office Setup program provided that your computer
has the .NET Framework 1.1 or a later version of the .NET
Framework already installed. You can distribute the Office
PIAs by using the Microsoft Office Primary Interop Assemblies
(PIAs) redistributable.
http://support.microsoft.com/kb/840585
So I bought a copy of Office Professional 2007 (I was overdue
anyway) and installed it, but the VB statement above still gives
me an error message saying that:
Namespace or type specified in the Imports
'Microsoft.Office.Interop.Excel' doesn't contain any public
member or cannot be found.
I see two possibilities:
1) VS 2008 Express just doesn't cut it. I know that with VS 2008
Professional you get something called Visual Studio Tools for
Office, but I was under the impression that having the PIAs installed
was enough to get you connected to Excel, and that all VSTO added
was a bunch of templates and tools that made Office programming
easier. But perhaps I was wrong, and VS 2008 Express is not capable
of using the PIAs? I can get a copy of VS 2008 Professional, but
I would rather use Express if possible. And in any case I am not
certain that is the problem. The other possibility is:
2) There were two CDs in the Office Professional 2007 box, but only
one was used in the installation process. So what is on Disc 2,
and why wasn't it asked for? I'm concerned because I tried to do
a custom install that would install *everything*, including the
PIAs, but the procedure was kind of confusing. I was given a tree
with the various Office components, and a bunch of dropdown choices,
in particular "Run from My Computer" and "Run All from My Computer".
(This is from memory, so I may be a bit off). The installation
help said that if you chose "Run All" then all the subcomponents
would also be installed, so I checked that at the highest level
(Office), and the boxes for all the subcomponents turned white
(some had been gray), and by my reading of the help this is what
I wanted. But perhaps I did a minimum install, rather than a
maximum? So it would be very very helpful to know:
2a) How can I find out if the PIAs in fact were installed?
2b) If I need to do a reinstall, how do I make sure I get
it right this time?
Thanks in advance for any help you can give me!
may have a different problem. I hope someone will be able to tell
me which, and if the problem was the install, give me some advice
about reinstalling and getting it right.
What I want to do is use Visual Studio to write a VB.NET app that
reads and writes Excel workbooks. I have already done this in a
corporate setting (using VS 2005 Team Edition), but now I need to
do it on my home computer. In the corporate setting, if I wanted
the code in a module or class to be able to access Excel, I inserted
the following statement at the beginning of the file:
Imports Excel = Microsoft.Office.Interop.Excel
This didn't work at home, where I was using Excel 2002 and Visual
Studio 2008 Express. With a little research I found I needed these
things called PIAs (Primary Interop Assemblies), that came with
Office 2003 and 2007, but were not installed by default:
Office 2003 and later versions of Office include PIAs with
the Office Setup program. The Office PIAs may be installed
with the Office Setup program provided that your computer
has the .NET Framework 1.1 or a later version of the .NET
Framework already installed. You can distribute the Office
PIAs by using the Microsoft Office Primary Interop Assemblies
(PIAs) redistributable.
http://support.microsoft.com/kb/840585
So I bought a copy of Office Professional 2007 (I was overdue
anyway) and installed it, but the VB statement above still gives
me an error message saying that:
Namespace or type specified in the Imports
'Microsoft.Office.Interop.Excel' doesn't contain any public
member or cannot be found.
I see two possibilities:
1) VS 2008 Express just doesn't cut it. I know that with VS 2008
Professional you get something called Visual Studio Tools for
Office, but I was under the impression that having the PIAs installed
was enough to get you connected to Excel, and that all VSTO added
was a bunch of templates and tools that made Office programming
easier. But perhaps I was wrong, and VS 2008 Express is not capable
of using the PIAs? I can get a copy of VS 2008 Professional, but
I would rather use Express if possible. And in any case I am not
certain that is the problem. The other possibility is:
2) There were two CDs in the Office Professional 2007 box, but only
one was used in the installation process. So what is on Disc 2,
and why wasn't it asked for? I'm concerned because I tried to do
a custom install that would install *everything*, including the
PIAs, but the procedure was kind of confusing. I was given a tree
with the various Office components, and a bunch of dropdown choices,
in particular "Run from My Computer" and "Run All from My Computer".
(This is from memory, so I may be a bit off). The installation
help said that if you chose "Run All" then all the subcomponents
would also be installed, so I checked that at the highest level
(Office), and the boxes for all the subcomponents turned white
(some had been gray), and by my reading of the help this is what
I wanted. But perhaps I did a minimum install, rather than a
maximum? So it would be very very helpful to know:
2a) How can I find out if the PIAs in fact were installed?
2b) If I need to do a reinstall, how do I make sure I get
it right this time?
Thanks in advance for any help you can give me!