473,791 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Worksheets from Existing Excel Instances in VB.NET?

Hi everyone,

I use the following code whenever I export to Excel from VB.NET

objExcel = New Excel.Applicati on()
objWorkBooks = objExcel.Workbo oks
objWorkBook = objWorkBooks.Ad d
objWorkSheet = objExcel.Active Workbook.Active Sheet

The problem is that every time I need to export, it results in creating
a new instance of Excel in memory. Excel is a bit of a resource hog,
and suffers from memory leaks. Is there a way to open another
worksheet from an Excel process/instance that is already running if
there is one?

How would I do this?

Thanks!

May 1 '06 #1
2 2186
If objExcel is nothing then
objExcel = New Excel.Applicati on()
End if

Use that code and you won't generate a new Excel application every time.

<le****@hotmail .com> wrote in message
news:11******** *************@j 33g2000cwa.goog legroups.com...
Hi everyone,

I use the following code whenever I export to Excel from VB.NET

objExcel = New Excel.Applicati on()
objWorkBooks = objExcel.Workbo oks
objWorkBook = objWorkBooks.Ad d
objWorkSheet = objExcel.Active Workbook.Active Sheet

The problem is that every time I need to export, it results in creating
a new instance of Excel in memory. Excel is a bit of a resource hog,
and suffers from memory leaks. Is there a way to open another
worksheet from an Excel process/instance that is already running if
there is one?

How would I do this?

Thanks!

May 2 '06 #2
objExcel is not a global variable and only accessible in this function.
If Excel is already opened manually by the user I would like to use
that instance as well. Is there a way to attach to an existing
process?

+Vice wrote:
If objExcel is nothing then
objExcel = New Excel.Applicati on()
End if

Use that code and you won't generate a new Excel application every time.

<le****@hotmail .com> wrote in message
news:11******** *************@j 33g2000cwa.goog legroups.com...
Hi everyone,

I use the following code whenever I export to Excel from VB.NET

objExcel = New Excel.Applicati on()
objWorkBooks = objExcel.Workbo oks
objWorkBook = objWorkBooks.Ad d
objWorkSheet = objExcel.Active Workbook.Active Sheet

The problem is that every time I need to export, it results in creating
a new instance of Excel in memory. Excel is a bit of a resource hog,
and suffers from memory leaks. Is there a way to open another
worksheet from an Excel process/instance that is already running if
there is one?

How would I do this?

Thanks!


May 2 '06 #3

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

Similar topics

3
13607
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to find some place where I could look up a HOWTO doc/recipe to do that using either pyExcelerator or win32com.client. Could someone point me in the right direction? I'm at the stage where the spreadsheet and associated data worksheets
1
4620
by: Mitch | last post by:
I am using Access to create an Excel spreadsheets with graphs related to rows on the sheet1 to the graph on sheet2. I am using the same data but different subsets of the data to make different spreadsheets for different groups. The spreadsheet formats are the same for each of the different groups. So I am using a loop to requery the data for the different groups and create a new spreadsheet for each group. The three graphs on sheet 2...
0
1472
by: helraizer1 | last post by:
Hi folks, I have made a ledger sub in Excel. The task is to create a spreadsheet solution for a foreign exchange bureau so each transaction that happens it adds the details to a ledger sheet. For this I have this code: Sub ledge() Dim r As Excel.Range Dim i As Integer
1
5605
by: CoreyReynolds | last post by:
I can't find any information on this. If I have an existing query and I want to dump it into a page on a spread sheet and modify it as a pivot table all in VBA, can I do that? I only have the code so far (that works) to dump in the data and create a chart based off it... except I have to manually alter the data I dumped in into a pivot table for the chart to make sense every time.... it sure would be nice if VBA would do it for me! Heres...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.