+ Reply to Thread
Results 1 to 14 of 14

VBA code in Windows XP does not work in Window 7

  1. #1
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    VBA code in Windows XP does not work in Window 7

    I have received a .xlsm file from a co-worker using XP. The macros (which import data from specified file locations) will not run properly under W7. I get an "Automation error, Unspecified error" popup when I try to run them. The popup opens the VB debugger, but doesn't give any indication of where the code stopped.

    I am not a programmer, but can usually read someone else's code and figure out what's going on. The co-worker I got it from has no experience in Windows 7 and no W7 system to try to fix it on. Is there some relatively easy fix for this I can incorporate or communicate to my co-worker?

    We are both using Excel 2007.
    Last edited by handerson0603; 08-21-2012 at 11:54 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA code in Windows XP does not work in Window 7

    attach the file, we can test

  3. #3
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    Here is one of the macros (others give the same error), but I don't think there's anything wrong with it. When I try to run it, it stops on the first line. The entire file contains data I don't want to share, and would take some time to scrub.

    It has been suggested that there is some issue with permissions across the network, but it stops before I can tell it which files to open, so that doesn't seem likely.

    Please Login or Register  to view this content.
    Last edited by handerson0603; 08-21-2012 at 01:05 PM.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA code in Windows XP does not work in Window 7

    I tried som changes, but there are many non defined function.
    May be on XP he has some library installed

  5. #5
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: VBA code in Windows XP does not work in Window 7

    There's a chance that you haven't selected certain References in the new version. In the VBE, go to TOOLS-REFERENCES. Look for something like Microsoft Word 11.0 Object Library (it may be different in newer versions, but I don't have on my work computer to test. If it's not checked, give it a check mark and retry.

  6. #6
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    Quote Originally Posted by patel45 View Post
    I tried som changes, but there are many non defined function.
    May be on XP he has some library installed
    That is just a small part of one of the modules in his code. The functions are defined elsewhere. I confirmed that it's nothing in the code by commenting out the entire block except for the Public Sub and End Sub lines. I still get the same error.

    Quote Originally Posted by BigBas View Post
    There's a chance that you haven't selected certain References in the new version. In the VBE, go to TOOLS-REFERENCES. Look for something like Microsoft Word 11.0 Object Library (it may be different in newer versions, but I don't have on my work computer to test. If it's not checked, give it a check mark and retry.
    I compared references with my co-worker and they are identical.

  7. #7
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    I also confirmed that it is not Win7 admin issues... I logged in as admin and get the same errors when I run it.

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA code in Windows XP does not work in Window 7

    Quote Originally Posted by handerson0603 View Post
    That is just a small part of one of the modules in his code. The functions are defined elsewhere.
    Then how can we test the code ?

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA code in Windows XP does not work in Window 7

    Can you compile the workbook on Win 7?
    Remember what the dormouse said
    Feed your head

  10. #10
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    Quote Originally Posted by patel45 View Post
    Then how can we test the code ?
    Keep reading ..."I confirmed that it's nothing in the code by commenting out the entire block except for the Public Sub and End Sub lines. I still get the same error." You don't need to test the code because I get an error before it ever executes any of the code.

    Edit: I hope this doesn't come across as snarky. I certainly didn't intend it that way, and am grateful for any help you can offer.

    ---------- Post added at 07:32 AM ---------- Previous post was at 07:30 AM ----------

    Quote Originally Posted by romperstomper View Post
    Can you compile the workbook on Win 7?
    As I stated originally, I am not a programmer, so I don't know anything about compiling. If you tell me how (or point me to a resource), I'll try it and let you know the results.
    Last edited by handerson0603; 08-22-2012 at 01:15 PM.

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA code in Windows XP does not work in Window 7

    Open the VBEditor on the problem machine, and click Debug - Compile VBAProject.

  12. #12
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    Quote Originally Posted by romperstomper View Post
    Open the VBEditor on the problem machine, and click Debug - Compile VBAProject.
    I get the same "Automation error | Unspecified error" as soon as I hit "Compile".

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA code in Windows XP does not work in Window 7

    It sounds to me as though there is an incompatibility with a library or object used in the workbook. Are you using the same Office version on both machines?

  14. #14
    Registered User
    Join Date
    08-27-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: VBA code in Windows XP does not work in Window 7

    Yes, both are using 2007, identically configured by corporate IT.

    I probably should have brought this up earlier, but our IT significantly beefed up security when they went to W7. I've had lots of issues doing things that used to be easy on XP, but I've tried all the tricks I have learned so far that have given us problems on other issues.
    Last edited by handerson0603; 08-22-2012 at 03:58 PM.

+ 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