Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Anyone on here any good with VB6???

Thread Tools
 
Search this Thread
 
Old 11 July 2005, 08:43 PM
  #1  
JayPSC
Scooby Regular
Thread Starter
 
JayPSC's Avatar
 
Join Date: Jan 2003
Location: Swindon
Posts: 847
Likes: 0
Received 0 Likes on 0 Posts
Default Anyone on here any good with VB6???

Using VB to access a Excel spreadsheet & return data to another txt file but when I close the Excel sheet down when I've finished with it, I get a dialog box asking if I want to save the sheet, how do I turn this dialog off??
Sure I've done this before but it's been a couple years since I've done any coding & I've forgotten most of what I knew lol.
Jay
Old 12 July 2005, 07:44 AM
  #2  
rmn
BANNED
 
rmn's Avatar
 
Join Date: Jan 2005
Location: Kirkbymuppetside
Posts: 1,296
Likes: 0
Received 0 Likes on 0 Posts
Question

What is VB?
Old 12 July 2005, 08:21 AM
  #3  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Default

I dont use VB6 (spawn of the devil I tell ya!) but have doen OLE automation more with word than excel. You should be able to issue a close command with DoNotSaveChanges parameter.

My code would be:
ovDoNotSaveChanges := wdSaveOptions(wdDoNotSaveChanges);
FWord.ActiveDocument.Close(ovDoNotSaveChanges, EmptyParam, EmptyParam);

I use something called late binding when I do COM so I have to do a little extra coding but if you add the excel type library (in your office folder) via the VB IDE you should get all the commands and more importantly the code completion will give you the correct syntax.

Gary
Old 12 July 2005, 10:09 AM
  #4  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

something along these lines should work

ActiveWorkbook.Close savechanges:=False

or

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Old 13 July 2005, 12:38 PM
  #5  
JayPSC
Scooby Regular
Thread Starter
 
JayPSC's Avatar
 
Join Date: Jan 2003
Location: Swindon
Posts: 847
Likes: 0
Received 0 Likes on 0 Posts
Default

Thank you SN to the rescue again lol
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
33
29 August 2017 07:18 PM
Scott@ScoobySpares
Full Cars Breaking For Spares
7
14 December 2015 08:16 AM
Mattybr5@MB Developments
Full Cars Breaking For Spares
20
22 October 2015 06:12 AM
blackandz
General Technical
0
12 September 2015 07:01 PM



Quick Reply: Anyone on here any good with VB6???



All times are GMT +1. The time now is 11:14 AM.