Unable to close Excel

Hello everyone
I have written code like this
CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
  CALL METHOD OF FILE 'OPEN'
    EXPORTING
      #1 = 'C:temp8D.xls'
      #2 = 1.
  CALL METHOD OF EXCEL 'CELLS' = CELL
    EXPORTING
      #1 = 6
      #2 = 'C'.
  SET PROPERTY OF CELL 'VALUE' = zak_help.
CALL METHOD OF EXCEL 'CELLS' = CELL
    EXPORTING
      #1 = 7
      #2 = 'S'.
  SET PROPERTY OF CELL 'VALUE' = 'X'.
CALL METHOD OF EXCEL 'SAVE'.
  FREE OBJECT EXCEL.
After that:
call function 'POPUP_TO_CONFIRM'
    EXPORTING
      TITLEBAR              = 'Display report'
      TEXT_QUESTION         = 'Display report?'
      DEFAULT_BUTTON        = '1'
      DISPLAY_CANCEL_BUTTON = 'X'
      START_COLUMN          = 25
      START_ROW             = 6
    IMPORTING
      answer                = ans.
if ans eq '1'.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        window_title            = 'Select file for upload'
        default_extension       = 'Excel files (*.XLS)|*.XLS'
        file_filter             = 'Excel files (*.XLS)|*.XLS'
        initial_directory       = 'C:TEMP'
      CHANGING
        file_table              = li_filetable
        rc                      = lv_return
      EXCEPTIONS
        file_open_dialog_failed = 1
        cntl_error              = 2
        error_no_gui            = 3
        OTHERS                  = 4.
    read table li_filetable into lw_filetable index 1.
    p_file = lw_filetable-filename.
DATA gs_excel TYPE ole2_object .
  DATA gs_wbooks TYPE ole2_object .
  DATA gs_wbook TYPE ole2_object .
  DATA gs_application TYPE ole2_object .
  CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
  SET PROPERTY OF gs_excel 'Visible' = 1 .
  GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
  GET PROPERTY OF gs_wbooks 'Application' = gs_application .
*--Opening the existing document
  CALL METHOD OF gs_wbooks 'Open' = gs_wbook
    EXPORTING
      #1 = p_file.
But after all, the excel process still works. In Task Manager it exists. How can I 'kill' it, directly after closing the window?
Thanks for any help.
Greetings

Add
         CALL METHOD OF EXCEL 'QUIT'.
before freeing object.
Look at <a href="http://support.microsoft.com/kb/153043/fr">Controlling Alerts and Updating in MS Excel OLE Server</a> at microsft help.
         oWBook.SaveAs FileName:="C:my documentstest.xls"
         ' Closes the original workbook without saving changes.
         oWBook.Close False
         oXL.Quit    ' Closes the invisible instance of Microsoft Excel.
Regards

Similar Messages

  • Close excel programmatically after user cancels file selection

    Greetings all. I apologize but I incorrectly posted this question on the wrong board originally so am posting it again here. I have a VI that I wrote with some help from this site that reads in as many user selected Flat Data Files as desired into Excel. The VI opens Excel, places each Flat Data File on one row and ends, allowing the user to manipulate the Excel data as desired. I have tested it without problems with up to 100 files at a time. The VI minimizes Excel at startup so that it will not block the Select File(s) dialogue. MY problem is this: If the user cancels the file selection, it returns an error and leaves Excel open. I understand how to handle the error, but have been unable to make Excel close automatically if the action is canceled. I have tried to invoke the Close without saving node with no luck... probably because I don't understand how to apply it. Ideally, I want to take the error number to a case statement, and if it is anything other than zero (0), meaning no error, I want Excel to close down. This will eventually be an executable so I need to make this right. Can anybody help? I have attached a zip file with the VI's and some sample Flat Data Files.
    Thanks
    Attachments:
    RTS Flat File Data.zip ‏103 KB

    If you want anything to run after an error you must clear the error status boolean from the error cluster. To do this use the bundle by name and set the status value to FALSE, take this output cluster into the function you wish to run.
    Andrew Alford
    Production Test Engineering Technologist
    Sustainable Energy Technologies
    www.sustainableenergy.com

  • Automatically open, save and close excel?

    I need import data from Excel to SQL.
    Now, I use tSQL to directly read the excel files and transform to the SQL table.
    As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
    Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
    However, this will make the data in the excel double and result a large excel file.
    I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
    Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
    Then I can directly use this excel for data import.
    Is there any simple way to do so? I don't know marco much...
    Ivan

    No formula could do this (Automatically open, save and close excel).
    You need to recode a marco or write a macro. Why donot you ask in msdn?
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    example:
    Sub auto_open()
    Application.OnTime Now + TimeValue("00:01:00"), "wswx"
    End Sub
    Sub
    wswx() If Not ThisWorkbook.Saved
    Then ThisWorkbook.Save
    ThisWorkbook.Close
    End Sub
    KR

  • Unable to close the posting periods in MM

    Hello
    while using MMPV  the system says that the date not current calender year. If I check OMSY the  open year is 2002.I need to know that how you close the open periods of previous years.I am supposed to close all the periods one by one but how to close them for the year 2002.
    I tried to initialise the periods as well but the system asks me to check OSS notes 487381 before initialisation.
    Please guide me as I've read all the threads related to this error but still unable to close the periods.
    Thanks & Regards
    Ashish

    Hi,
    You need to close the periods one by one from 2002. There is no other way.
    Go to OMSY check what is the current period,
    e.g it is 02/2002.
    then got MMPV,
    Enter 03 and year as 2002 then execute, repeate till 12/2002,
    then again start MMPV from 01/2003 to 12/2003. you have to perform this till current period of 2008.
    Thanks
    Edited by: anand k on Aug 20, 2008 12:44 PM

  • Unable to close some custom forms

    Hi Gurus,
    We did application migration from Hp-Unix to Sun Solaris. Oracle apps 11.5.10.2 with database 10.2.0.4 and application working good with few issues.
    Issues:
    1. Few custom forms ( message Forms) unable to close. If we close by clicking X mark on top right corner, it does not close can just minimise.
    2. Couple of Custom forms does not open even we have .fmx in the custom folder.
    Need some suggestions on this issues.
    Thank You.

    f60gen module=ARXCUDCI.fmb userid=apps/apps output_file=/ul01/app/applmgr/lasrx/au/11.5.0/forms/US/ARXCUDCI.fmx
    Compiling ON-DELETE trigger on CODE_ASSIG_HIST data block...
    No compilation errors.
    Compiling WHEN-BUTTON-PRESSED trigger on BP_CLOSE item in CODE_ASSIG_HIST data block...
    No compilation errors.
    Compiling WHEN-NEW-ITEM-INSTANCE trigger on CURRENT_RECORD_INDICATOR item in CODE_ASSIG_HIST data block...
    No compilation errors.
    Compiling WHEN-MOUSE-UP trigger in FOLDER_PROMPT_MULTIROW property class...
    No compilation errors.
    Compiling WHEN-BUTTON-PRESSED trigger in FOLDER_OPEN property class...
    No compilation errors.
    Created form file /ul01/app/applmgr/lasrx/au/11.5.0/forms/US/ARXCUDCI.fmx
    Thanks You.

  • Unable to close iPad2 attachments

    I am brand new to the apple community, so please bear with me for the newbee question.
    After configuring my brand new iPad2 yesterday to sync with my mail provider, I opened an email attachment and I am unable to close it.
    When I press and hold the top of the attachment a keyboard dropdown appears, but there is nothing else on the page.
    When I go back to the main menu and re-open email, the attachment is still there and I can't access the mailbox.
    Can someone point me in the right direction?
    Thanks

    When you tap on the attachment-while it is open-do you not see a blue "Done" button in the upper left corner? If so, tap it to close the attachment.
    If the mail app is frozen, you can force quit it and restart the iPad.
    Force quit the app by holding down on the sleep button until the red slider appears. Let go of the sleep button and then hold down on the home button until the app quits. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Or just quit the mail app this way and restart.
    In order to quit or close apps - Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • Unable to close windows

    I didn't find any other threads on this problem, so evidently it's just my system?
    A few days ago I installed the latest Tiger security patch (2007-009), Java 6 update and Quicktime 7.3.1 update.
    Since then I am unable to close ANY window in Safari. Safari seems to work fine otherwise. I can browse and open tabs and windows, and websites can create new windows, but then I can not close ANY of the windows. I can close tabs but not windows. When I click the Close button, nothing happens, and when I use ⌘+W, nothing happens.
    So, after a while of surfin' the 'net, I end up with a bunch of open windows of various sizes. When I re-open Safari, I get one new window with the Home tab.
    I just recently began using Safari again, because it's 3x faster than Firefox on my iBook, but now I've got this problem.
    Any ideas?
    I will likely be calling Apple Support today, although I hate to, as I've found them to be very unknowledgeable and unhelpful in the past.

    Hi,
    Go to these 2 locations to see if you have any 3rd party extensions and move anything present in them onto your Desktop to deactivate them:
    /Users/YourUsername/Library/InputManagers/
    /Library/InputManagers/
    Restart Safari to pick up the change. If it works now, you can try moving the items back one by one until you find the culprit.
    If that doesn't help, or you don't have those folders, one quick test you can do to help narrow down things is to try Safari in another user account. This will help us to know whether your problem is local to your account or system wide. If you don't have another account you can use System Preferences -> Accounts -> \[+\] to create a test one (and \[-\] to remove it if needed)

  • Unable to close WeatherEye box due to Error 500

    when opening, the "weatherEye" box is now blank with only "Error 500 Internal Server Error"
                                                                                             Guru Meditation
                                                                                              XID 991114007
                                                                                              Varnish Cache Server            displayed at the top and I am unable to close box. Help?
      with many thanks, sarahjulie

    http://www.weather-eye.co.uk/faq.asp
    Also, iMacs don't run iOS.  They run Mac OS X, Linux or Windows.  Please update your signature with the Mac OS X version that someone might be able to help you.  Go to Apple menu -> About This Mac.

  • Unable to close the order

    I  am unable to close the order ...system hown this error messgae please any one guide me in this issue
    Unprocessed future change recs for order 1002655 prevent del. flag/completion
    Message no. CO688
    Diagnosis
    There are still future change records or error records to be processed from the confirmation for the confirmation processes in order 1002655. Possible confirmation processes are:
    Automatic goods receipt
    Backflushing
    Calculation of actual costs
    Data transfer to HR
    System Response
    You are not meant to set the deletion flag/'completed' status for orders with future change records that have not been processed.
    Procedure
    You should process the open future change records using
    Predefined confimration process or
    The CORUPROC program, by dispatching it in Customizing in a background job (dispatch background jobs: dispatching processes).
    Check if incorrect goods movements or incorrect actual cost calculations exist for the order, and reprocess these if necessary:
    Reprocessing incorrect goods movements
    Reprocessing incorrect actual cost calculations
    Regards
    GSD

    Sesidhar gollu,
    Well try to reprocess your order by using T-code COFC which will reprocess the future records. Try this and then ping me any questions if u have.
    Regards,
    Madhu.G

  • Unable to Close project

    We are unable to close the project because it is created for plant xxxx that was never used and is wrong anyhow.
    When attempting to close the Project xxxxx we get message stating that Purchase orders are open.
    By listing all PO's applicable to the project (SAP trans ME2J) we get a list of approx  25 purchase orders, some of which have the lines deleted, some of which are open. Our problem is that the Purchase Orders are all set up for Plant "xxxx".  and xxxx  does not exist as a plant!! SAP will not allow us to dealt these PO's without changing the plant reference but we cannot because these parts are not set up in other plants!

    Hi,
    How did you save the Project with the Plant which doesnot exist ??
    By the time your Project was created the Plant must have been operational in SAP & MM team might have removed it afterwards (if the system allowed)
    is this right??
    If so, then you can cross check with MM how to proceed to close / delete the PO line items.
    regards

  • Unable to close Safari windows

    I am unable to close any windows in Safari.
    I am able to expand and minimize them.
    I had been unable to open Safari which I resolved by removing the Safari preferences file and have tried repeating this as well as resetting Safari and running general maintenance proceedures such as permissions, scripts, etc. with no success.
    Is it possible to reinstall just Safari ( mine is version 2.03) or can this only be done through a system update?
    Thanks for your help!
    733 MHz Power PC G4   Mac OS X (10.4)  

    After attempting various fixes and several unsuccessful attempts at using the 10.4.7 combo updater I was finally able to update to 10.4.7 from my Tech Tool eDrive.
    Somewhere along this process, I think after the System update, my window problem was resolved.
    Thanks.
    733 MHz Power PC G4   Mac OS X (10.4)  

  • Unable to Close the book in Firefox

    Hi,
    I am Unable to Close the book in Firefox when WebHelp Pro
    application is opened through the robo server 7. When i open the
    help application all the books will be opened and they cannot be
    closed by clicking on them. But if i open the same file i.e.,
    projectname.htm directly inside the program
    file/adobe/roboserver..... it opens fine with all the books closed
    and can be opened on click.
    Adding to this each contextual call to the WebHelp pro is
    opening in a new window in Firefox 2.0.0.12. But all these works
    fine with ie7. Can anybody help me out in this regard?
    Thanks,
    Arun

    This sounds pretty similar to an issue that I am
    experiencing.
    Basically in IE5 on Windows 2000, IE6 and IE7 on Windows XP,
    the table of contents appear as required - all books are not
    expanded, and once the user clicks on a book, the book is expanded.
    However in IE7 in Windows Vista and in Firefox on all Windows
    platforms, the table of contents appears with all books expanded,
    and when clicking on a book, the book will not collapse.
    However if the same page is directly navigated to (e.g.
    http://servername.com/dir1/index.htm)
    the table of contents appears correctly (all books collapsed and
    users able to expand and collapse a book by clicking on it).

  • Unable to close web page using Safari 7.3.1

    Doing research and opened a page that required my name and password.  No idea what's going on and unable to close page even after force quitting Safari and restarting computer.

    Try starting Safari with the shift key held down.

  • CLOSE EXCEL

    Hi all :
    Please see attach file :
    How can I save and close excel automatically
    Thanks
    Attachments:
    Excel.vi ‏12 KB

    Hi
    I'm having this very problem.I'm trying to open write then save and close and I'm having trouble with the latter. Right now when I run by VI twice, I get a message saying the file is already open and whether I want to open it again, meaning that it wasn't closed in the first place. Is there a Save option rather than a SaveAs option
    I tried the VI uploaded by aeastet but I couldn't get it to work.
    Thanks
    Attachments:
    GS- Write to Excel.vi ‏17 KB

  • Write into worksheets and close excel

    can someone tells me why this doesnt work?
    i tried to
    open excel, open worksheet, write to new worksheet #2, autofit to one page for work sheet #2,
    write to new worksheet #3, autofit sheet #3. 
    all those are working...
    but when i tried closing the excel and saving it is when i have alot of errors. 
    can someone help me?
    thanks
    Attachments:
    Untitled 1.vi ‏18 KB
    Untitled Project 1.lvproj ‏7 KB

    I'm not sure which version of LabVIEW you are using, nor what some of the VIs are in your code.  However, if you have a recent version of LabVIEW (say 2012 or later) and have access to the Report Generation Toolkit, you will have a much easier time working with Excel.
    In January of this year, I posted an Example to replace the Excel example that ships with LabVIEW.  However, I'm not very good at finding my own posts on this forum, so I can't easily point you to it.  However, if you do use the Report Generation Toolkit and do not use ActiveX calls, you will find that the functions to open and close Excel Reports tend to work without significant problems (there is a glitch, that I've reported, whereby if you "manually" close the Excel Workbook and then try to close it with the Report Generation's "Save Workbook", it will actually delete the manually-saved Workbook for you)(there is a "work-around" until NI fixes this ...).
    Bob Schor

Maybe you are looking for

  • BI Publisher was connecting. now it isn't...

    I'm running 11g r2 on Vista 64. I installed OBIEE 11.1.1.5 using a 'simple install'. Right after the install, I was able to then open BI Publisher and browse the data from the small sample xml data. I don't recall having to use the supplied url to do

  • Resource Bundle being overwritten

    Hello, We are upgrading from jhs 9.03 to jhs 9.0.4.4. A new feature is resource bundles and that is were we are having problems with. We have two jhs subapplications and I want to use the same resource bundle class for both applications. The problem

  • allow tag in Vhost.xml

    I want to allow connections between applications running on my server. When setting <allow> tag in Vhost.xml to '12.34.56.78' (server ip address, i don't have domain name), server allows connections made from swf files running on the same server, but

  • How to install ios5 beta dmg on iphone 4?

    Hello i have paid for the developer account, and i got my permission to download the ios 5 beta and also itunes 10.5. So i did that and i downloaded itunes and installed it. no problems. I downloaded also tje ios5 for my iphone 4. But here the proble

  • Q:Creating Solaris 11.1 zone inside Solaris 11.1 LDOM fails

    Hello, I have a server where I've created a LDOM and I'd like to create zones inside that LDOMs and it isn't working at all for me. If I try to create a zone outside of my LDOM it works perfectly fine. What am I missing here? Control domain: host-22