+ Reply to Thread
Results 1 to 4 of 4

Macro works fine on Windows XP, but it gives error on Vista or 7

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    Milan
    MS-Off Ver
    Excel 2007
    Posts
    3

    Macro works fine on Windows XP, but it gives error on Vista or 7

    Sub.docxHi guys,

    as explained in the title I have a macro that works fine on laptops with Windows XP, but it give a runtime error 5 Invalid argument on Vista or Windows 7
    I use Excel 2007 and the same macro works fine on 2003 with XP.

    The aim of this macro is to download some datas from a website protected by username & password using html tags (names of sheets & website is left generic in the attachment). Macro is pretty long and I get the error at the written in yellow highlighted line (page 5 out of 8) of VB code (see attachment)

    Will anybody be able to explain the reason for it?

    Thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro works fine on Windows XP, but it gives error on Vista or 7

    Hello maxxian,

    After the release of Excel 2003, worksheets starting using the "Big Grid". You should never dimension row or column numbers as Integers, unless you are absolutely certain the values will never exceed 65535.

    Dimension your RowCount and ResultCol as Long. This will probably fix the problem. You may want to do this to other variables as well. Especially any that hold row or column numbers.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-12-2012
    Location
    Milan
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Macro works fine on Windows XP, but it gives error on Vista or 7

    Thanks for yr help. Anyway, the same macro with Excel 2003 worked. Problem is when OS is different than XP.
    By the way I have also tried yr suggested solution, but it did not work. I replaced all as integers with as long.
    Since Excel is opening IE in background, can any IE options be setup differently ? I tell you that bcs the other constant scenario is that macro works with IE 8, but not with IE 9.
    I haven't had the chance to combinate browser + OS (eg IE9+XP or IE8+Vista) to see what happens.
    Any other suggestions? Thanks

  4. #4
    Registered User
    Join Date
    04-12-2012
    Location
    Milan
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Macro works fine on Windows XP, but it gives error on Vista or 7

    No other suggestions? Thanks

+ 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