[Solved] Macro Not Working

Creating a macro - Writing a Script - Using the API

[Solved] Macro Not Working

Postby franklludwig » Fri Mar 23, 2018 6:22 pm

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.
Attachments
oo.jpg
Last edited by franklludwig on Sat Mar 24, 2018 12:42 pm, edited 1 time in total.
Open Office 4.1.4 on Windows 7
franklludwig
 
Posts: 4
Joined: Fri Mar 23, 2018 6:00 pm

Re: Macro Not Working

Postby Hagar Delest » Fri Mar 23, 2018 10:53 pm

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.
AOO 4.1.5 on Xubuntu 18.04 and on Windows 7 (with winPenPack port).
User avatar
Hagar Delest
Moderator
 
Posts: 28067
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Macro Not Working

Postby franklludwig » Sat Mar 24, 2018 8:34 am

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.)
Last edited by robleyd on Sat Mar 24, 2018 9:34 am, edited 1 time in total.
Reason: Added Code tags
Open Office 4.1.4 on Windows 7
franklludwig
 
Posts: 4
Joined: Fri Mar 23, 2018 6:00 pm

Re: Macro Not Working

Postby Zizi64 » Sat Mar 24, 2018 10:19 am

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.
Last edited by Zizi64 on Sat Mar 24, 2018 4:02 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO4.4.7, LO5.4.7 on Win7x64Prof.
PortableApps, winPenPack: LO3.3.0-LO6.0.4 and AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 6703
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Macro Not Working

Postby franklludwig » Sat Mar 24, 2018 12:41 pm

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.
Open Office 4.1.4 on Windows 7
franklludwig
 
Posts: 4
Joined: Fri Mar 23, 2018 6:00 pm

Re: [Solved] Macro Not Working

Postby Zizi64 » Sat Mar 24, 2018 4:00 pm

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)
Tibor Kovacs, Hungary; LO4.4.7, LO5.4.7 on Win7x64Prof.
PortableApps, winPenPack: LO3.3.0-LO6.0.4 and AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 6703
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] Macro Not Working

Postby franklludwig » Sat Mar 24, 2018 4:10 pm

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 ;)
Open Office 4.1.4 on Windows 7
franklludwig
 
Posts: 4
Joined: Fri Mar 23, 2018 6:00 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests