Page 1 of 1

[Solved] Macro Not Working

PostPosted: Fri Mar 23, 2018 6:22 pm
by franklludwig
Hi, I used to have Excel 2003 which is not compatible with Windows 10. I only used it for one Spreadsheet to keep an eye on my finances (which, due to my lack of expertise, took me ages to create). Now I opened it with OpenOfficeCalc, but unfortunately I can't run the macro any more. Could anyone have a look at it and tell me how I can make it work? Thanks.

Re: Macro Not Working

PostPosted: Fri Mar 23, 2018 10:53 pm
by Hagar Delest
Hi and welcome to the forum!

Basically, it would help to post the code instead of a screenshot.
The macro language is different so you've to adapt it with the OpenOffice basic language.

Re: Macro Not Working

PostPosted: Sat Mar 24, 2018 8:34 am
by franklludwig
The code is:

Code: Select all   Expand viewCollapse view
Sub update()
'
' update Macro
' Macro recorded 14/04/2007 by Frank L. Ludwig
'
' Keyboard Shortcut: Ctrl+u
'
    Range("J1").Select
    Selection.Copy
    Range("B1").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Range("D3:D19").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    Range("F3:F19").Select
    Selection.ClearContents
End Sub

(It appears the second part of it disappeared which looked dodgy to me, anyway.)

Re: Macro Not Working

PostPosted: Sat Mar 24, 2018 10:19 am
by Zizi64
Tips:

- try the LibreOffice. It has a littlebit higher compatibility with the foreign file types and the VBA macros.
- use the "Option VBASupport 1" directive at the begin of the code in the Module.
- try to rewrite your macros based on the AOO/LO API using the StarBasic or an another supported programming language.

Re: Macro Not Working

PostPosted: Sat Mar 24, 2018 12:41 pm
by franklludwig
Prior to posting here I had made several unsuccessful attempts to record a macro in the Open Office file. However, I tried it a few more times since and eventually succeeded.

Re: [Solved] Macro Not Working

PostPosted: Sat Mar 24, 2018 4:00 pm
by Zizi64
Recording the macros is not an efficient method, because the macro recorder of the AOO/LO has a limited capability.
You must WRITE your macros based on the API functions of the AOO/LO.

(API: Application Programming Interface)

Re: [Solved] Macro Not Working

PostPosted: Sat Mar 24, 2018 4:10 pm
by franklludwig
I only use calculations for one spreadsheet with one simple macro, and I got it to work now. It may not be the most sophisticated solution, but it does the job ;)