Consulting

Results 1 to 4 of 4

Thread: Debugging VBA built on Excel2013 not working on v2016

  1. #1

    Debugging VBA built on Excel2013 not working on v2016

    Hi!
    I am New here
    We updated recently to excel 2016 and when trying to run the onld VBAs we get errors in the code we did not get before the update... maybe there are changes we re not aware...


    Also, the code was developed by and external and have no clue what can be going wrong....






    We have the following code:





    Sub MainReadOpenedFile()
    
    
    Application.ScreenUpdating = False
    
    
    GFILENAME = InputBox("Please type your File Name with .xlsx", , "File Name.xlsx")
    
    
    GPMLibraryMasterSheet = "PM Library (Master)"
    
    
    If Not Right(GFILENAME, 5) = ".xlsx" Then
    
    
    GoTo FileErrorHandler
    
    
    ElseIf GFILENAME = " " Then
    
    
    GoTo FileErrorHandler
    
    
    Else:
    
    
    Application.ScreenUpdating = False
    
    
    OpenFileCheck = False
    
    
    Call ReadDataFromFile
    
    
    End If
    
    
    Exit Sub
    
    
    FileErrorHandler:
    
    
    MsgBox "Not an Excel file, please try again"
    
    
    End Sub
    
    
    
    
    
    
    Sub ReadDataFromFile()
    
    
    Application.ScreenUpdating = False
    
    
    Dim PMRoutineInfo(4) As Variant
    
    
    Dim TLCInfo(4) As Variant
    
    
    Dim TLCActivityX() As Variant
    
    
    Dim PMCActivity() As Variant
    
    
    Dim Compliance As String
    
    
    Dim PMRoutineSchedule(10) As Variant
    
    
    Dim TableInfo() As Variant
    
    
    Dim TLCNo As String
    
    
    Dim ErrorMessage As String
    
    
    FirstRow = 3 'First row of file. LastRow if meets "End"
    
    
    PMStartRow = FirstRow
    
    
    Do While Not Range("D" & PMStartRow).Value = "End" 'to stop the loop (in column D)
    
    
    ''''
    
    
    Application.ScreenUpdating = False
    
    
    Workbooks(OpenFile.GFILENAME).Activate
    
    Worksheets(OpenFile.GPMLibraryMasterSheet).Activate
    etc...






    But I have been getting errors on these last 2 lines: Run time error '9' "Subscript out of range"






    I am moving teams and must handover this soon, so was trying to test it to show it to my successor, but I cannot figure out what can be wrong here since I did not do the code, only guided the development of it, please your help!


    Thank youu!!
    Last edited by Paul_Hossler; 10-26-2020 at 02:44 PM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Do you have an external library that is not installed now?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Hi, not that I know about. I was running it at such.

    I got a suggestion tht this error might be due to not having the file opened in the same excel instance, and by opening one file out of the other resolved the problem.

    Thank you!

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    cross posted:

    Debugging VBA built on Excel2013 not working on v2016
    https://www.excelforum.com/excel-pro...-on-v2016.html
    Debugging VBA built on Excel2013 not working on v2016 | MrExcel Message Board
    https://www.mrexcel.com/board/thread...v2016.1149455/
    Debugging VBA built on Excel2013 not working on v2016 - Excel VBA / Macros - OzGrid Free Excel/VBA Help Forum
    https://www.ozgrid.com/forum/index.p...ba#post1240899
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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