473,769 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Excel Objects

I've written an application for reading information from a spreadsheet and
allowing the user to add and update information in the spreadsheet.

One spreadsheet I accessed in this fashion is now unreadable and get an
application error when I open it. I also can't delete it. I'm assuming
that I didn't properly close it down once. Is there any way I can correct
the problem

I finally got the application working OK. My remaining problem is that when
I open the workbook, the worksheets are hidden. How do I release the
spreadsheet in such a fashion that the worksheets are visible immediately
when I open the workbook?

David Gerstman
Jul 17 '05 #1
6 6526
OK, there's more than one question here, so here goes:

1) With the unreadable/not being able to delete - try looking for Excel in
the task manager after your program has closed. If it is, then do the
following to make sure that it's shut down in future:

ExcelApp.Quit
set excelapp = nothing

Of course depending on how you got the object "Excel.Applicat ion" might mean
that if Excel is open on the screen, it will close it down. There are loads
of issues with having Excel open and automating it in VB at the same time,
too many to list here, just have a play until you get what you want. I
always recommend setting the Excel object to nothing though, even if you
decide not to Quit it first.

2) Worksheets being hidden? Hmmm... I've never seen this, and for now I'd
assume it's a side-effect of issue #1 above. You can control whether tabs
are visible or hidden, of course (set the Sheet.Visible property to one of
the "Excel.XlSheetV isibility" constants as defined in the object browser.
If this ain't it - give us a shout an' we'll have another go.

Hope this helps.

Sparky.

"David Gerstman" <dh********@yah oo.com> wrote in message
news:Hr******** @arl.army.mil.. .
I've written an application for reading information from a spreadsheet and
allowing the user to add and update information in the spreadsheet.

One spreadsheet I accessed in this fashion is now unreadable and get an
application error when I open it. I also can't delete it. I'm assuming
that I didn't properly close it down once. Is there any way I can correct
the problem

I finally got the application working OK. My remaining problem is that when I open the workbook, the worksheets are hidden. How do I release the
spreadsheet in such a fashion that the worksheets are visible immediately
when I open the workbook?

David Gerstman

Jul 17 '05 #2
David,
Excel generates a temp file when you open any workbook. If the WB is not
properly closed, the temp file remains. attempting to reopen the WB will
cause an error. Restarting Excel usually deletes this temp file and you're
fine. Or delete the temp file, if you can find it; in the same directory as
the WB, unless it's from the network, then...
If this does not work, then may the WB file is corrupt and can't be opened
any way.

The .Hidden/Visible property can applies to many objects; Excel, WB,
worksheet, window. Which are you having to reset ?
Are you saving the WB after you change the visibility ?

NickHK

"Sparky" <ne**********@h otmail.com> wrote in message
news:bu******** **@news8.svr.po l.co.uk...
| OK, there's more than one question here, so here goes:
|
| 1) With the unreadable/not being able to delete - try looking for Excel
in
| the task manager after your program has closed. If it is, then do the
| following to make sure that it's shut down in future:
|
| ExcelApp.Quit
| set excelapp = nothing
|
| Of course depending on how you got the object "Excel.Applicat ion" might
mean
| that if Excel is open on the screen, it will close it down. There are
loads
| of issues with having Excel open and automating it in VB at the same time,
| too many to list here, just have a play until you get what you want. I
| always recommend setting the Excel object to nothing though, even if you
| decide not to Quit it first.
|
| 2) Worksheets being hidden? Hmmm... I've never seen this, and for now
I'd
| assume it's a side-effect of issue #1 above. You can control whether tabs
| are visible or hidden, of course (set the Sheet.Visible property to one of
| the "Excel.XlSheetV isibility" constants as defined in the object browser.
| If this ain't it - give us a shout an' we'll have another go.
|
| Hope this helps.
|
| Sparky.
|
| "David Gerstman" <dh********@yah oo.com> wrote in message
| news:Hr******** @arl.army.mil.. .
| > I've written an application for reading information from a spreadsheet
and
| > allowing the user to add and update information in the spreadsheet.
| >
| > One spreadsheet I accessed in this fashion is now unreadable and get an
| > application error when I open it. I also can't delete it. I'm assuming
| > that I didn't properly close it down once. Is there any way I can
correct
| > the problem
| >
| > I finally got the application working OK. My remaining problem is that
| when
| > I open the workbook, the worksheets are hidden. How do I release the
| > spreadsheet in such a fashion that the worksheets are visible
immediately
| > when I open the workbook?
| >
| > David Gerstman
| >
| >
|
|
Jul 17 '05 #3
Sparky, I really appreciate your help.

I have done the ExcelApp.quit and set it to "nothing"

I have those in the Form_Unload sub. Do they belong someplace else? (When I
stop in middle of debugging, does Form_Unload execute? I think so.)

I also assume that the hidden spreadsheet is a function of not shutting down
correctly. I'll probably try the visibility stuff.

Thank you VERY much.

David

"Sparky" <ne**********@h otmail.com> wrote in message
news:bu******** **@news8.svr.po l.co.uk...
OK, there's more than one question here, so here goes:

1) With the unreadable/not being able to delete - try looking for Excel in the task manager after your program has closed. If it is, then do the
following to make sure that it's shut down in future:

ExcelApp.Quit
set excelapp = nothing

Of course depending on how you got the object "Excel.Applicat ion" might mean that if Excel is open on the screen, it will close it down. There are loads of issues with having Excel open and automating it in VB at the same time,
too many to list here, just have a play until you get what you want. I
always recommend setting the Excel object to nothing though, even if you
decide not to Quit it first.

2) Worksheets being hidden? Hmmm... I've never seen this, and for now I'd assume it's a side-effect of issue #1 above. You can control whether tabs
are visible or hidden, of course (set the Sheet.Visible property to one of
the "Excel.XlSheetV isibility" constants as defined in the object browser.
If this ain't it - give us a shout an' we'll have another go.

Hope this helps.

Sparky.

"David Gerstman" <dh********@yah oo.com> wrote in message
news:Hr******** @arl.army.mil.. .
I've written an application for reading information from a spreadsheet and allowing the user to add and update information in the spreadsheet.

One spreadsheet I accessed in this fashion is now unreadable and get an
application error when I open it. I also can't delete it. I'm assuming
that I didn't properly close it down once. Is there any way I can correct the problem

I finally got the application working OK. My remaining problem is that

when
I open the workbook, the worksheets are hidden. How do I release the
spreadsheet in such a fashion that the worksheets are visible immediately when I open the workbook?

David Gerstman


Jul 17 '05 #4
Nick
I never wrote anything to affect visibility.
However, I'll add a line.
I really appreciate your pointer here. It explains some of the problems I'm
having. I think.
I'm going to look for the temp file.
Again thank you so much!
David

"Nick HK" <Ni****@TungChe eWah.Invalid> wrote in message
news:bu******** **@imsp212.netv igator.com...
David,
Excel generates a temp file when you open any workbook. If the WB is not
properly closed, the temp file remains. attempting to reopen the WB will
cause an error. Restarting Excel usually deletes this temp file and you're
fine. Or delete the temp file, if you can find it; in the same directory as the WB, unless it's from the network, then...
If this does not work, then may the WB file is corrupt and can't be opened
any way.

The .Hidden/Visible property can applies to many objects; Excel, WB,
worksheet, window. Which are you having to reset ?
Are you saving the WB after you change the visibility ?

NickHK

"Sparky" <ne**********@h otmail.com> wrote in message
news:bu******** **@news8.svr.po l.co.uk...
| OK, there's more than one question here, so here goes:
|
| 1) With the unreadable/not being able to delete - try looking for Excel
in
| the task manager after your program has closed. If it is, then do the
| following to make sure that it's shut down in future:
|
| ExcelApp.Quit
| set excelapp = nothing
|
| Of course depending on how you got the object "Excel.Applicat ion" might
mean
| that if Excel is open on the screen, it will close it down. There are
loads
| of issues with having Excel open and automating it in VB at the same time, | too many to list here, just have a play until you get what you want. I
| always recommend setting the Excel object to nothing though, even if you
| decide not to Quit it first.
|
| 2) Worksheets being hidden? Hmmm... I've never seen this, and for now
I'd
| assume it's a side-effect of issue #1 above. You can control whether tabs | are visible or hidden, of course (set the Sheet.Visible property to one of | the "Excel.XlSheetV isibility" constants as defined in the object browser. | If this ain't it - give us a shout an' we'll have another go.
|
| Hope this helps.
|
| Sparky.
|
| "David Gerstman" <dh********@yah oo.com> wrote in message
| news:Hr******** @arl.army.mil.. .
| > I've written an application for reading information from a spreadsheet
and
| > allowing the user to add and update information in the spreadsheet.
| >
| > One spreadsheet I accessed in this fashion is now unreadable and get an | > application error when I open it. I also can't delete it. I'm assuming | > that I didn't properly close it down once. Is there any way I can
correct
| > the problem
| >
| > I finally got the application working OK. My remaining problem is that | when
| > I open the workbook, the worksheets are hidden. How do I release the
| > spreadsheet in such a fashion that the worksheets are visible
immediately
| > when I open the workbook?
| >
| > David Gerstman
| >
| >
|
|

Jul 17 '05 #5
"David Gerstman" <dh********@yah oo.com> wrote in message
news:Hr******** @arl.army.mil.. .
Sparky, I really appreciate your help.

I have done the ExcelApp.quit and set it to "nothing"

I have those in the Form_Unload sub. Do they belong someplace else? (When I stop in middle of debugging, does Form_Unload execute? I think so.)


If you by that mean pressing the "Stop" button in the IDE, the andwer is NO!

That is the same as using End. Your program stops abruptly, without any form
of cleanup

--
Dag.
Jul 17 '05 #6
I've a good mind to write a program that enums the processes, and those it
can't find an hwnd for and that are excel, it kills. I'd have it running as
a service.

"Sparky" <ne**********@h otmail.com> wrote in message
news:bu******** **@news8.svr.po l.co.uk...
OK, there's more than one question here, so here goes:

1) With the unreadable/not being able to delete - try looking for Excel in the task manager after your program has closed. If it is, then do the
following to make sure that it's shut down in future:

ExcelApp.Quit
set excelapp = nothing

Of course depending on how you got the object "Excel.Applicat ion" might mean that if Excel is open on the screen, it will close it down. There are loads of issues with having Excel open and automating it in VB at the same time,
too many to list here, just have a play until you get what you want. I
always recommend setting the Excel object to nothing though, even if you
decide not to Quit it first.

2) Worksheets being hidden? Hmmm... I've never seen this, and for now I'd assume it's a side-effect of issue #1 above. You can control whether tabs
are visible or hidden, of course (set the Sheet.Visible property to one of
the "Excel.XlSheetV isibility" constants as defined in the object browser.
If this ain't it - give us a shout an' we'll have another go.

Hope this helps.

Sparky.

"David Gerstman" <dh********@yah oo.com> wrote in message
news:Hr******** @arl.army.mil.. .
I've written an application for reading information from a spreadsheet and allowing the user to add and update information in the spreadsheet.

One spreadsheet I accessed in this fashion is now unreadable and get an
application error when I open it. I also can't delete it. I'm assuming
that I didn't properly close it down once. Is there any way I can correct the problem

I finally got the application working OK. My remaining problem is that

when
I open the workbook, the worksheets are hidden. How do I release the
spreadsheet in such a fashion that the worksheets are visible immediately when I open the workbook?

David Gerstman


Jul 17 '05 #7

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

Similar topics

1
4803
by: dave | last post by:
how do i send and recieve cell values between vb6 and excel. please supply a sample thanx
17
27285
by: Ange T | last post by:
Hi there, I'm having pain with the VB behind an Access form. The form is used to create reports in Excel based on the details entered in the form. This has always worked without error on my machine (NT4, Access 2k), however as soon as I attempt to create anything on another machine (NT4, Access 2k) which most users will be working from, I receive an automation error. The problem line with the code is:
2
5437
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been recommended by many for web applications. I create the instances of Excel, Workbook and the worksheet. And later on Release the references by “System.Runtime.InteropServices.Marshal.ReleaseComObject(Object)” and making the object as null finally....
0
2252
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I then need to 'trap' the current file and generate an XML file from the data within the active spreadsheet. I have two issues so far with doing this... Issue 1: Once a file that is being watched is saved, I grab it using the
4
3251
by: Lisa | last post by:
Hi - I'm able to open excel workbooks and word documents, but I can't seem to copy excel charts, named ranges, etc. to a word document. Anyone know of good reference material in this area? What little documentation I've been able to find focuses on using only one office app at a time. Thanks for your help
1
3254
by: funcSter | last post by:
I want to retrieve data from an Excel file like how I would with a database. I understand that I would have to use OLE DB. Somehow I think I cannot get the connection string right, as the bit of code fails at "objConn.Open()" with the error: System.Data.OleDb.OleDbException: Could not find installable ISAM. Can somebody please help me out? I'm still a learning programmer, so if someone can point out my mistakes, it'll be great! Thanks! ...
9
4549
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso TypeOf obj Is IDisposable Then DirectCast(obj, IDisposable).Dispose()
7
2165
by: =?Utf-8?B?VGVycnkgSG9sbGFuZA==?= | last post by:
I have a vb.net app that opens an excel worksheet, reads data and then closes the sheet. Im noticing that the Excel process is still running after I have closed and disposed of my excel objects. The following code (Test1) demonstrates the essence of what I am doing. When I check the processes while ruinning the method, I notice that the Excel process remains after exiting the sub (and until I exit the application) Sub Test1 Dim...
0
9586
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
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...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
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
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.