+ Reply to Thread
Results 1 to 8 of 8

Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

  1. #1
    Registered User
    Join Date
    03-12-2015
    Location
    germany
    MS-Off Ver
    2007
    Posts
    8

    Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    So like the headline says: Why is Excel VBA executing a command correctly if I run it in debug modus, but in "normal" modus it does nothing?

    It is about the command:

    Please Login or Register  to view this content.
    Last edited by zbor; 04-02-2015 at 05:52 AM. Reason: Code tags

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    Try to wait some time so it can execute properly.
    This will wait 2 seconds but try few time and adjust for yourself:

    Please Login or Register  to view this content.
    Also, please use code tags around your code as per forum rules. I've edit now for you.
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    03-12-2015
    Location
    germany
    MS-Off Ver
    2007
    Posts
    8

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    Thanks for editing and answering. That was the solution. But even then there is a problem. I want to execute this command to upload my excel workbook to a ftp and the time the shell needs depends highly on the file I'm uploading. It can between 0,7mb and 200mb. The time is of course very different then. Is it possible to set the timeout according to it?

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    You can try with FileLen function:

    Please Login or Register  to view this content.
    test size before executing Shell.
    Then try for some different lenght how many time each file size need to upload.
    If you can determine needed time comparing to file size you can adjust Wait function.

    Add few seconds just in case but even that won't guarantee that it will work each time because your speed can vary.

  5. #5
    Registered User
    Join Date
    03-12-2015
    Location
    germany
    MS-Off Ver
    2007
    Posts
    8

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    The problem is that the filesize is not linear proportional to the upload time. E.g. If the i-net connection is slow it takes much longer to upload. Is there another way to let excel vba execute the command properly no matter how long the upload takes?
    Last edited by flextexmex; 04-02-2015 at 06:16 AM.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    Yes, I know.
    Are you uploading lot of files one after other or just few?

  7. #7
    Registered User
    Join Date
    03-12-2015
    Location
    germany
    MS-Off Ver
    2007
    Posts
    8

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    Just one file 2 times with a size of maximum 200mb. But the upload time can vary very much... it can take up to 30 minutes...
    Last edited by flextexmex; 04-02-2015 at 06:24 AM.

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Why is Excel VBA executing a command corretly in debug modus but not in normal mode?

    I would still make this corelation and then you can have one dummy file (let say 2MB) that will be uploaded first and then aproximate for those largest files.

    Or just put 1 hour and let it over night to upload

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  2. [SOLVED] Code skips on Run Mode but runs fine on F8 (Debug Mode)
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-25-2013, 01:05 PM
  3. Can I use VBA to check if the sheet(xxx) is in Page-Break mode or Normal mode ?
    By BaLLZaCH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2008, 09:03 AM
  4. [SOLVED] Excel 2000 Code works except in debug mode
    By Bob Smedley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2006, 09:25 PM
  5. Strange Excel behaviour in debug mode
    By valk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2005, 06:56 AM

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