PC Review


Reply
Thread Tools Rate Thread

close excel with no selection

 
 
byggemandBob
Guest
Posts: n/a
 
      3rd Nov 2008
Hello, im using excel as a COM object in axapta to import data, when im done
I want to move the excel file into a folder called "IMPORTED"

but when I use:
application.DisplayAlerts(false); //dont prompt saving message
application.quit(); //quit app

I get a "Microsoft Visual Basic" run-time error '1004'

I need a way to close the file w/o any prompts cause I cant move the file as
its not closed by untill I press "END" on the debug box


PS:
The VB error is caused by a for /next that deletes special menues created to
print the excel file. The file itselfe comes from a different company so im
not much interested in fixing the vb error as its most likley only a error
outside their excelsetup (oooor something :P)
 
Reply With Quote
 
 
 
 
Don M.
Guest
Posts: n/a
 
      3rd Nov 2008
I'm no VB expert at all, but I had a similar problem with unwanted prompts. I
used these lines to solve it. Maybe you can use it.

Application.DisplayAlerts = False
Windows("YourFileNameHere").Close
Application.DisplayAlerts = True

Don
 
Reply With Quote
 
byggemandBob
Guest
Posts: n/a
 
      4th Nov 2008
Hi, thanks for answering, im allready using Application.DisplayAlerts = False
application.DisplayAlerts(false); this is the method im using on my side of
a COM object this gets rid of the "do you wanna save" box.

But what I want is to get rid of a messagebox that comes due to a VB
run-time error created inside excel as its closed. This messagebox stops
windows from closing the file and that meens that someone is still accessing
the file and then I cant move the file to another loaction.

as Application.DisplayAlerts = False only seems to remove normal allerts
such as remember to save I was wondering if there would be something to
ignore or auto close a runtime error message.

hope I make any scense
 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close msgbox after making selection John Keith Microsoft Excel Programming 13 1st Apr 2010 08:25 AM
close calendar control form after selection KUMPFfrog Microsoft Excel Programming 3 26th Jan 2009 05:04 AM
Excel shoud not close all active books when clicking close button =?Utf-8?B?dGVjaG5vbWlrZQ==?= Microsoft Excel Misc 0 10th Jun 2005 05:35 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Microsoft Excel Programming 3 7th Jun 2004 09:13 PM
combo box close on selection help!! Simon Lloyd Microsoft Excel Programming 6 25th May 2004 10:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.