Macro issue

Hi guys,

When i run the MS Excel macro in libre office, it runs correctly but shows
the output while clicking on the cell on which output comes.

Option VBASupport 1
Sub Button1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Range("B1").Select
a = ActiveCell.Text
Range("B3").Select
b = ActiveCell.Text
c = a + b
Range("B8").Select
ActiveCell.FormulaR1C1 = c
End Sub

Thanks & Regards,
Heena Gupta

Hi guys,

  When i run the MS Excel macro in libre office, it runs correctly but shows
the output while clicking on the cell on which output comes.

Option VBASupport 1
Sub Button1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Range("B1").Select
a = ActiveCell.Text
Range("B3").Select
b = ActiveCell.Text
c = a + b
Range("B8").Select
ActiveCell.FormulaR1C1 = c
End Sub

Thanks & Regards,
  Heena Gupta

Are you saying that the screen updates while your macro runs?

To quote Bernard Marcelly: (see http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=42396)

Freezing screen is done with method lockControllers() of the document's Model.
Freezing recalculations is done with method addActionLock() of the document.
With Basic it's simple:

myDoc = ThisComponent

myDoc.lockControllers()
myDoc.addActionLock()
' --- modify your cells here ---
myDoc.removeActionLock()
myDoc.unlockControllers()|

If you are asking what I think you are asking, you would only lock and unlock the controller and not use the action lock.

Hi :slight_smile:
It is interesting that it works at all! LibreOffice uses a slightly
different programming language for it's macros so often people have to
translate the MS ones into LibreOffice Basic (or Python or whatever else).

Since the statements are so simple this time i wonder if it just needs some
tweaking or needs to be copy&pasted into a fresh new macro or something?
Hopefully someone on this list will be able to give you a much better
answer!
Good luck and regards from
Tom :slight_smile:

Hi :slight_smile:
It is interesting that it works at all! LibreOffice uses a slightly
different programming language for it's macros so often people have to
translate the MS ones into LibreOffice Basic (or Python or whatever else).

Maybe ”Option VBASupport 1” has something to do with it?

Johnny Rosenberg

Hi :slight_smile:
WOW!! I didn't realise the option existed! That is magic and potentially
hugely simplifies one problem i have been delaying dealing with :))))

LibreOffice gets more and more awesome the more i find out about it.
Many thanks and regards form
Tom :slight_smile:

VBASupport is (sadly) far from perfect, but, it does apparently handle many of the simple common things.