Results 1 to 12 of 12

Thread: [RESOLVED] Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

  1. #1
    Frenzied Member NeedSomeAnswers's Avatar
    Join Date
    Jun 02
    Location
    Top of the Perch
    Posts
    1,120

    Resolved [RESOLVED] Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Hi Everyone,

    i am having a strange problem with Excel, I am looking after a some excel files for a colleague while they are away and i cant run the macro's in them.

    My collegue has Excel 2003 and the file has been saved as a .xls, while i have 2007.

    When i try and run the macro it error's saying - "File Not Found VBA6.DLL"

    When i look this up it just seems to be the Visual Basic for Application reference. 2007 seems to have a slightly differently named file but it is there.

    Also if i create a macro in a new workbook it works fine.

    Does anyone have any ideas why i wouldn't be able to run a macro in a 2003 workbook inside 2007 ?

    Thanks
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  2. #2
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,415

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Show me the code that you are trying to run...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  3. #3
    Frenzied Member NeedSomeAnswers's Avatar
    Join Date
    Jun 02
    Location
    Top of the Perch
    Posts
    1,120

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    No Problem, there is a class called clsSheetManager with the following code in it -

    vb Code:
    1. Private mSheet As String
    2. Private mManager As String
    3.  
    4. Public Property Get Sheet() As String
    5.     Sheet = mSheet
    6. End Property
    7. Public Property Let Sheet(ByVal v As String)
    8.     mSheet = v
    9. End Property
    10.  
    11. Public Property Get Manager() As String
    12.     Manager = mManager
    13. End Property
    14. Public Property Let Manager(ByVal v As String)
    15.     mManager = v
    16. End Property

    Then this is the main code;

    vb Code:
    1. Sub RePopulate()
    2.     Dim cNames As Collection
    3.     Dim oSN As clsSheetManager
    4.    
    5.     Dim shtAll As Object, rowAll As Long, colAll As Long
    6.     Dim shtN As Object, rowN As Long, colN As Long
    7.     Dim shtPrev As Object
    8.    
    9.     Dim sManager As String, sPrevManager As String
    10.    
    11.     Call Refresh_All
    12.     Set shtAll = Sheets("All")
    13.    
    14.     Set cNames = New Collection
    15.     rowAll = 2
    16.     Do While Trim$(shtAll.Cells(rowAll, 2)) <> ""
    17.         sManager = shtAll.Cells(rowAll, 2)
    18.         If sManager <> sPrevManager Then
    19.             Call AddNames(cNames, sManager, Left$(sManager, 1 + InStr(1, sManager, " ", vbTextCompare)))
    20.         End If
    21.         sPrevManager = sManager
    22.         rowAll = rowAll + 1
    23.     Loop
    24.    
    25.        
    26.     shtAll.Columns("A:A").Select
    27.     Selection.NumberFormat = "d-mmm-yyyy"
    28.    
    29.     Sheets("All").Select
    30.    
    31.     shtAll.Cells.Select
    32.     shtAll.Cells.EntireColumn.AutoFit
    33.    
    34.     Range("A2").Select
    35.     ActiveWindow.FreezePanes = True
    36.  
    37.     Set shtPrev = shtAll
    38.     For Each oSN In cNames ' For each manager in the collection.
    39.         rowN = 0
    40.         colN = 0
    41.         rowAll = 2
    42.         On Error Resume Next
    43.         Set shtN = Sheets(oSN.Sheet)
    44.         If Err.Number = 0 Then 'found so delete and re-create
    45.             Application.DisplayAlerts = False
    46.             Call Sheets(oSN.Sheet).Delete
    47. '            Call sht.Delete 'Sheets.Delete(oSN.Sheet)
    48.             Application.DisplayAlerts = True
    49.         End If
    50.         On Error GoTo 0
    51.         Set shtN = Sheets.Add(, shtPrev)
    52.         Set shtPrev = shtN
    53.         shtN.Name = oSN.Sheet
    54.        
    55.         colAll = 1
    56.         Do While Trim$(shtAll.Cells(1, colAll)) <> ""
    57.             colN = colAll
    58.             shtN.Cells(1, colN) = shtAll.Cells(1, colAll)
    59.             colAll = colAll + 1
    60.         Loop
    61.        
    62.         rowAll = 2
    63.         rowN = 2
    64.         Do While Trim$(shtAll.Cells(rowAll, 2)) <> ""
    65.             colAll = 1
    66.             colN = 1
    67.             If StrConv(Trim$(shtAll.Cells(rowAll, 2)), vbUpperCase) = _
    68.                StrConv(Trim$(oSN.Manager), vbUpperCase) Then ' Manager name matches the require one.
    69.                 If StrConv(Trim$(shtAll.Cells(rowAll, 3)), vbUpperCase) <> _
    70.                    StrConv(Trim$(shtAll.Cells(rowAll - 1, 3)), vbUpperCase) Then
    71.                     rowN = rowN + 1
    72.                 End If
    73.                 Do While Trim$(shtAll.Cells(rowAll, colAll)) <> ""
    74.                     colN = colAll
    75.                     shtN.Cells(rowN, colN) = shtAll.Cells(rowAll, colAll)
    76.                     colAll = colAll + 1
    77.                 Loop
    78.                 rowN = rowN + 1
    79.             End If
    80.             rowAll = rowAll + 1
    81.         Loop
    82.        
    83.         shtN.Columns("A:A").Select
    84.         Selection.NumberFormat = "d-mmm-yyyy"
    85.    
    86.         shtN.Columns("D:D").Select
    87.         Selection.NumberFormat = "0.00"
    88.        
    89.         shtN.Rows("1:1").Select
    90.         Selection.Font.Bold = True
    91.         Selection.Font.Underline = xlUnderlineStyleSingle
    92.  
    93.         shtN.Cells.Select
    94.         shtN.Cells.EntireColumn.AutoFit
    95.    
    96.         shtN.Select
    97.         Range("A2").Select
    98.         ActiveWindow.FreezePanes = True
    99.    
    100.     Next oSN
    101.    
    102. End Sub
    103.  
    104. Sub Refresh_All()
    105. '
    106. ' Keyboard Shortcut: Ctrl+r
    107.    
    108.     For n = 3 To 13
    109.         Sheets(n).Delete
    110.     Next
    111.    
    112.     Sheets("All").Select
    113.     Cells(1, 1).Select
    114.    
    115.     Selection.QueryTable.Refresh BackgroundQuery:=False
    116. End Sub
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  4. #4
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,415

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Ok click on Menu Tool~~>References

    Uncheck the 1st reference to "Visual Basic For application" and then click on browse button and then navigate to this path...

    "c:\Program Files\Common Files\Microsoft Shared\vba\vba6"

    Click on vba6.dll

    Also confirm that Microsoft office 12.0 object library is selected. If Microsoft office 11.0 object library is selected then unselect it...

    Now give it a try...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  5. #5
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,415

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    sorry that is vbe6.dll
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  6. #6
    Frenzied Member NeedSomeAnswers's Avatar
    Join Date
    Jun 02
    Location
    Top of the Perch
    Posts
    1,120

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Right ok,

    I dont have the VBA6.dll file. I have a file called VBE6.dll in the location. I am not sure why i don't have this file, should i with Office 2007 installed ?

    Also i cannot untick the reference for "Visual Basic for Applications" as "the control or reference is in use".

    The currently selected file is - C:\Windows\system32\MSVBVM60.DLL (for the Visual Basic for Applications reference)

    The Microsoft office 12.0 object library is definitely selected
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  7. #7
    Frenzied Member NeedSomeAnswers's Avatar
    Join Date
    Jun 02
    Location
    Top of the Perch
    Posts
    1,120

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Aha just seen your edit,

    Tried this but firstly i still cannot remove the current reference to "Visual Basic for Applications", and secondly if i try to add it as well i get the error "Name conflict with existing module, project or object library"

    I have noticed that if i open a brand new workbook the reference is set to the VBE6.DLL file.
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  8. #8
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,415

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Do a file save as and saves it as .xlsm and then reopen the file and now check...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  9. #9
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,465

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Two things going on...

    1. You are interacting with a newer version
    2. The newer version is possibly not macro enabled workbook.

    So you need to answer, is the user going to have 2007 installed? If not then the 2007 workbook wont work.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  10. #10
    Frenzied Member NeedSomeAnswers's Avatar
    Join Date
    Jun 02
    Location
    Top of the Perch
    Posts
    1,120

    Re: Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.DLL

    Hi Guys thanks for the help.

    In answer to your question RobDog some will have 2007, some wont which is why the spreadsheet is in .xls format currently.

    What i did to work around the problem is, firstly saved the workbook as a macro enabled workbook, then did my editing and finally then saved it back as a .xls file.

    It seems that in 2007 if you have a .xls file with macro's in it they wont run once you have in anyway edited the macros in the file.

    Koolsid :- i would add to your rep but apparently i need to "Spread it around" first :0)
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  11. #11
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,465

    Re: [RESOLVED] Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.

    Even with older versions, there still was the macro enabled prompt. With 2007 MS decided to separate macros from non-macroed workbooks.
    This lead to the xlsm and basically all .???m file extensions in all 2007 Office file with the exception of Outlook.
    If you were only dealing with 2003 and before versions Im sure this wouldnt have been a probfor you.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  12. #12
    New Member
    Join Date
    Sep 10
    Posts
    1

    Lightbulb Re: [RESOLVED] Running 2003 workbook with Macro in 2007 - error; File Not Found VBA6.

    FYI - I was having a related problem in Word VBA in Office 2007 where my Reference to Visual Basic for Applications was to C:\WINDOWS\system32\MSVBVM60.DLL but it couldn't resolve basic library functions like UserForm.Show vbModeless and thus couldn't compile. To resove I changed the following registry key:

    HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\6.0\9\win32

    From: C:\WINDOWS\system32\MSVBVM60.DLL
    To: C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL

Posting Permissions

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