Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 3rd, 2003, 01:31 PM
jamor jamor is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Tamarac, FL
Posts: 2 jamor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to jamor
How do I close an Excel Workbook instance to prevent sharing violation?

Here's an excerpt of my code:

Dim xlApp As Excel.Application ' new instantiation of Excel
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

'-- Open Excel and Select CheckBook Worksheet
xlApp.Workbooks.Open excelFile
xlApp.ActiveWorkbook.Worksheets
(txtActiveWorkSheet.Text).Select

'-- Code in here to Update Excel Workbook


xlApp.ActiveWorkbook.Save
xlApp.ActiveWorkbook.Close
xlApp.Workbooks.Close

Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing

Reply With Quote
  #2  
Old July 4th, 2003, 08:20 AM
krinpit krinpit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Ireland
Posts: 16 krinpit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 6 sec
Reputation Power: 0
Have you tried

xlBook.close

or
'*** Close and save the workbook ***
xlBook.Close(vbYes)

Reply With Quote
  #3  
Old July 4th, 2003, 09:56 AM
jamor jamor is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Tamarac, FL
Posts: 2 jamor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to jamor
I thought I had tried that, but I'm not sure anymore. I will give it a try. Thank you krinpit

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How do I close an Excel Workbook instance to prevent sharing violation?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway