+ Reply to Thread
Results 1 to 4 of 4

File won't open in XLSTART after modifications in macro code are made

  1. #1
    Registered User
    Join Date
    08-23-2011
    Location
    Toronto,Ontario
    MS-Off Ver
    Excel 2003
    Posts
    48

    File won't open in XLSTART after modifications in macro code are made

    I have a file in the XLSTART folder that activates a macro when the file is opened. The macro controls 2 open applications. The Excel file with the macro is opened when a third application that is running opens Excel with the Excel command line after an event has occurred.

    I have been tweaking the macro because of problems with SendKeys. Sometimes it will work 10 times straight without a problem and then it leaves the cursor position in the wrong place after it leaves one of the open applications and switches to the other. The macro switches from the open applications using the Shell method without a problem and automatically goes to the position of where the cursor was last positioned before the focus was taken away. Sometimes I have to enter data in the exact position that was last activated.

    Sometimes after I have made modifications in the tweaking process and saved the file with the new VBA alterations the file won't open when I try to see how the modifications have worked out.

    In order to make the file open in XLSTART I have to change the file name. The file that opens instead is the standard empty Excel workbook "Book 1".

    The following template of the file name change is what I am doing now:

    FileName_3.xls is changed to FileName_4.xls to get the file to open.

    When the FileName_4 opens then the Excel workbook "Book "1 doesn't.

    I have rebooted the computer and it still won't open a particular filename. Is there something inherent in Excel that causes this failure to open a file such as faulty code and Excel "flags" the file name somehow, or is there a special way to save the file to ensure that it will open?

    It's a head scratcher.

    Danny

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: File won't open in XLSTART after modifications in macro code are made

    perhaps check the disabled items list in help-about excel
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    08-23-2011
    Location
    Toronto,Ontario
    MS-Off Ver
    Excel 2003
    Posts
    48

    Re: File won't open in XLSTART after modifications in macro code are made

    JosephP,

    That'll do 'er.

    While I was modifying my code at times I used the "ESC" key to halt the macro then make changes and then continue to run the remaining code but I would get an error message next time I was opening the file. I did not know that the file was automatically disabled because sometimes I would simply doubleclick on the file in the XLSTART folder and would it would open with the message about macros being present in the file. I bypassed the message and then I would would click F5 and the macro would run. It seems that it only wouldn't open when being opened through the normal process after a modification.

    As a sidebar question if I may? What is the cause of the problems with SendKeys. I have had to enter 0.5 second timers between separate commands or sometimes group commands together in sequential lines of code to make sure all the commands were enacted, especially when repositioning the cursor. It is a trial and error process.

    How do I show the post "Solved" and give you your due accolades for your assistance?

    Danny

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: File won't open in XLSTART after modifications in macro code are made

    sendkeys is notorious for being unreliable and should only be used as a last resort. I've heard that using doevents in between calls can be helpful

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1