PDA

View Full Version : [SOLVED:] Debugging VBA built on Excel2013 not working on v2016



Nyaralist
10-26-2020, 12:58 PM
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!!

Bob Phillips
10-27-2020, 05:10 AM
Do you have an external library that is not installed now?

Nyaralist
10-27-2020, 06:09 AM
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!

p45cal
10-28-2020, 04:31 PM
cross posted:

Debugging VBA built on Excel2013 not working on v2016
https://www.excelforum.com/excel-programming-vba-macros/1331042-debugging-vba-built-on-excel2013-not-working-on-v2016.html
Debugging VBA built on Excel2013 not working on v2016 | MrExcel Message Board
https://www.mrexcel.com/board/threads/debugging-vba-built-on-excel2013-not-working-on-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.php?thread/1228439-debugging-vba-built-on-excel2013-not-working-on-v2016/&postID=1240899&highlight=debugging%2Bvba#post1240899