# VBA Script Conversion - BASIC runtime error. '35' Toolbars

Hello,

I have used Libra Office for many years. This is my first time dealing with a VBA script. This is about possible conversion of the script so it may work in LibreOffice Calc. I have also used EXCEL alot in my professional career, but never had Microsoft Office on my home system having never used Windows on my home system. I am looking for advise and pointers that will hopefully allow me to convert this spreadsheet to work in LibreOffice. I have lots of varied and diverse IT experience over a number of years. I am not afraid to write or convert code, but VBA is new to me be it EXCEL or LibreOffice so I am green to VBA scripting and how it interfaces in this case to a spreadsheet.

I recently was sent a link to a spreadsheet used in EXCEL that also is supposed to use the "SOLVER32.DLL" of 16 November 2000. That is not a typo for the dll date. There are two files involved, a .xls file and a .xla file. The .xla file is called "SOLVER.XLA". My understanding is the "SOLVER.XLA" is an EXCEL extension, and it is my understanding the VBA script/extension has user VBA. I am assuming, possibility incorrectly, the user VBA is within the .xls file.

When I open the spreadsheet .xls file the error "BASIC runtime error. '35' Toolbars" occurs with "Toolbars("STS-1").Visible = True" line of what I suspect is VBA script highlighted. I know this i user VBA code because of the "STS-1" reference in the code is user specific and context for the intent of the spreadsheet.

The related code to the above noted error is:

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Public SolverFlag As Boolean

Private Sub Auto_Open()

Toolbars("STS-1").Visible = True
Toolbars("STS-1").ToolbarButtons(3).OnAction = "RunSolver"
Toolbars("STS-1").ToolbarButtons(4).OnAction = "SpringSolve"
Toolbars("STS-1").ToolbarButtons(5).OnAction = "SavePlotData"
Toolbars("STS-1").ToolbarButtons(7).OnAction = "SetChartTitles"
Toolbars("STS-1").ToolbarButtons(8).OnAction = "ProtectAll"
ProtectAll
CheckSolver

End Sub

Private Sub Auto_Close()

Toolbars("STS-1").Visible = False

End Sub


My sense is the above code is likely in the spreadsheet .xls file. Is there a simple way to confirm the above source is in the .xls file?

The version of LibreOffice being used is Version: 6.3.2.2

I noticed the ask.libreoffice system seems to automatically mark some code sample as code and other parts of the code sample not code. I have not seen how I can specifically mark all the sample code as code. I have searched ask.libreoffice to find out, but so far have not been successful in finding out how to do so with ask.libreoffice, but have done so with ease and ease to find out on other similar posting venues.

edit retag close merge delete