+ Reply to Thread
Results 1 to 11 of 11

Macro works in Excel 2007 but not 2010. HELP!

  1. #1
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Macro works in Excel 2007 but not 2010. HELP!

    Hello,

    I recently added a bit of code to an invoice system Excel Forum helped me create. It works fine on my PC but not on any other PC's which use it which run 2010. I've included the full macro below. The new section starts under 'Sales Ledger Input Code and finishes before print out. Please help!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Macro works in Excel 2007 but not 2010. HELP!

    At what point does it fail? How does it fail? Is there an error message? If so, what is it? What line of code, if any, is highlighted? Have you stepped through the code using F8? If so, what happens?

    Code looks ok but impossible to test without a file.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Macro works in Excel 2007 but not 2010. HELP!

    Quote Originally Posted by Mark Dynes View Post
    ... finishes before print out ...
    Like TMS above => "... impossible to test without a file ..." plus additionally what below:

    1. Do not use "Date" and "Total" as variable names:

    Date => it is VB "Statement / Function"
    Total => it is "Property" for "ListColumn" object

    (I also have concerns about "#" characters in variable names)

    2. In your code for new files, e.g.:
    Please Login or Register  to view this content.
    you don't have "\" between the path and the value in "H4". Does it mean that you have this sign in "H4" ?

    3. Check the modified code below and observe in which line the error will occur and what type ?
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 07-07-2020 at 06:10 PM.

  4. #4
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Macro works in Excel 2007 but not 2010. HELP!

    Hi Trevor,
    It fails at the first line which is highlighted in VBA. Using F8 doesn't move it through the code just rehighlights the same line of code. On executing the macro an error message pops up with 'Run-time error '70': Permission denied

  5. #5
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Macro works in Excel 2007 but not 2010. HELP!

    THanks,

    I will test this out and come back to you. Will try and get a file posted too.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Macro works in Excel 2007 but not 2010. HELP!

    It fails at the first line which is highlighted in VBA.
    Not sure which line you mean.

    I used to live in Bramhall, not a million miles away from Stockport

  7. #7
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Macro works in Excel 2007 but not 2010. HELP!

    Lovely place Bramhall!

    It fails at 'Date = Sheets("SalesInvoice").Range("H3")' and won't move on through the rest at all on the other PC's.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Macro works in Excel 2007 but not 2010. HELP!

    As porucha vevrku said earlier, don't use Date = since that will attempt to set your system date. Use a different variable name.
    Rory

  9. #9
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Macro works in Excel 2007 but not 2010. HELP!

    OK Thanks Ill change that now! See how we go!

  10. #10
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Macro works in Excel 2007 but not 2010. HELP!

    Yes that's fixed it!!!! Thanks guys! Onto the next mini project

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Macro works in Excel 2007 but not 2010. HELP!

    You're welcome. Thanks for the rep.

+ 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. Excel 2007 works but not 2010 or 2013
    By Miliano in forum Excel General
    Replies: 1
    Last Post: 10-02-2014, 03:20 AM
  2. Workbook won't display after macro is complete (works just fine in Excel 2010, 2007)
    By gilwoodring in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2014, 06:36 PM
  3. Replies: 4
    Last Post: 04-10-2014, 12:11 PM
  4. Pivot table macro works in 2010 but not in 2007
    By JEllison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2013, 01:23 PM
  5. [SOLVED] Excel macro works in 2010 but nothing happens in 2007
    By onbeillp111 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 08:46 AM
  6. Why does this following macro not work in 2010 but works in 2007?
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2012, 01:23 PM
  7. Macro works correctly on Excel 2010, but not on 2007...why?
    By matgray87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2011, 06:04 AM

Tags for this Thread

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