473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Code working in one sub routine, but not another

I am using the following code in 2 separate sub routines:

Dim xlApp As New myExcel.Application
Dim xlBook As New myExcel.Workbook
Dim xlSheet As New myExcel.Worksheet

xlBook = xlApp.Workbooks.Add
xlSheet = xlBook.Worksheets.Add

In one subroutine it works fine, in the second subroutine, i get a
"Additional information: COM object with CLSID
{00020819-0000-0000-C000-000000000046} is either not valid or not
registered." error.

Any ideas?
Jun 27 '06 #1
2 909
Where exactly does it fail/throw the exception?

Jonathan Smith wrote:
I am using the following code in 2 separate sub routines:

Dim xlApp As New myExcel.Application
Dim xlBook As New myExcel.Workbook
Dim xlSheet As New myExcel.Worksheet

xlBook = xlApp.Workbooks.Add
xlSheet = xlBook.Worksheets.Add

In one subroutine it works fine, in the second subroutine, i get a
"Additional information: COM object with CLSID
{00020819-0000-0000-C000-000000000046} is either not valid or not
registered." error.

Any ideas?


Jun 27 '06 #2
On the second line, the " Dim xlBook As New myExcel.Workbook"

but i don't know why as the exact same code works in another subroutine in
the same class

"Ahmed" wrote:
Where exactly does it fail/throw the exception?

Jonathan Smith wrote:
I am using the following code in 2 separate sub routines:

Dim xlApp As New myExcel.Application
Dim xlBook As New myExcel.Workbook
Dim xlSheet As New myExcel.Worksheet

xlBook = xlApp.Workbooks.Add
xlSheet = xlBook.Worksheets.Add

In one subroutine it works fine, in the second subroutine, i get a
"Additional information: COM object with CLSID
{00020819-0000-0000-C000-000000000046} is either not valid or not
registered." error.

Any ideas?


Jun 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
2
by: Tony Williams | last post by:
I have an input form which has a command button called cmdSave. Thre procedure behind this button does 2 things 1. It validates that 2 text controls are completed and 2. Pops up lots of message...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
3
by: Scott Kilbourn | last post by:
Hi, I added some custom code to the InitalizeComponent function of a control that I'm working on. Every once in a while, I've noticed that the code that I added disappears. I finally tracked...
5
by: R. MacDonald | last post by:
Hello, all, I am currently working on a .Net (VB) application that invokes routines in unmanaged (Fortran) DLLs. The unmanaged routines then communicate with the .Net application by means of a...
26
by: Martin Jørgensen | last post by:
Hi, I don't understand these errors I get: g++ Persort.cpp Persort.cpp: In function 'int main()': Persort.cpp:43: error: name lookup of 'j' changed for new ISO 'for' scoping Persort.cpp:37:...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
4
by: Polar | last post by:
Hello everyone! I'm new here. I am doing a project, Digital Compass Navigation Aids. It consists of the 1490 Digital Compass, a P18F4620 Microcontroller, ISD2560 voice record/playback chip LM4808M...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.