From the help post of dg97112c, I encountered the same problem and saw that this post solved it.
Post address: http://topic.csdn.net/u/20110428/09/aa420af6-670b-4d5e-9e3c-02a45df488dd.html
Problem:
Vs2010 + office2003
The referenced
When output, the following message is displayed:
Retrieving components whose CLSID is {00020819-0000-0000-c000-000000000046} in the com class factory failed because of the following:
Error: 80040154 no registered category (exception from hresult: 0x80040154 (regdb_e_classnoregulatory )).
I have found many ways to configure DCOM on the Internet. The problem is still the same. The Office is also reinstalled, and changing to Office XP and Office2000 is the same problem.
Solution:
Original code:
Dim xlapp as new excel. Application
Dim xlbook as new excel. Workbook
Dim xlsheet as new excel. Worksheet
I found the problem. When I defined xlbook and xlsheet, I used new. Khan, too careless to look at other people's programs. I thought there was new.
The correct statement is as follows:
Dim xlapp as new excel. Application
Dim xlbook as Excel. Workbook
Dim xlsheet as Excel. Worksheet
Xlbook = xlapp. workbooks. Open ("C: \ 1.xls ")
Xlsheet = xlbook. worksheets (1)
I have seen many such errors on the Internet. I don't know if they are all my mistakes. Hope to have a group for you