Anyone on here any good with VB6???
#1
Scooby Regular
Thread Starter
Join Date: Jan 2003
Location: Swindon
Posts: 847
Likes: 0
Received 0 Likes
on
0 Posts
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
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
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
#3
Scooby Regular
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes
on
0 Posts
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
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
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
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