LibreOffice Calc Macro Question

br4

New member
Member
VIP
Local time
5:24 AM
Messages
110
Location
Florida - Tampa area
I have a workbook created in Excel that I've been using for a long time without any problems. In attempting to run a macro in Calc (first time in Calc), I'm getting the following error message:

BASIC runtime error.
'91'
Object variable not set.

It points to line 16 of the code:

8 Sheets("avgs").Select
9 Rows("3:3").Select
10 Selection.Insert Shift:=xlDown
11 Range("A4").Copy
12 Range("A3").Select
13 ActiveSheet.Paste
14 Dim rngC As Range
15 For Each rngC In Range("A3")
16 rngC = DateSerial(Year(rngC), Month(rngC) + 1, Day(rngC))
17 Next

Any ideas how to get this to run in Calc?

Also, is there a way to get the list of the workbook's macros to show immediately, without having to dive into the folders to find them?
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Just from a generic coding basis, (not used Libreoffice other than basic look at it)

Line 16 does show a number of spaces in the formula - 16 rngC»=»DateSerial(Year(rngC),»Month(rngC)»+»1,»Day(rngC))

Try removing those spaces that I have marked »

Some coding languages will ignore extraneous spaces, others will not which could be the case here

It could also be that the syntax for the line 14 Dim rngC As Range is incorrect or must be declared at the start of the code (some coding languages are a little pedantic), but this is not obvious as the variable rngC is used in line 15 without throwing an error
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
Thanks for the reply.

I removed the spaces as you noted but that didn't work either. My workbook has two macros, one much simpler than the other. I re-recorded the simpler one and am amazed at the difference in code between Calc's VBA code and Excel's code. I would have thought that, with minor differences, the two sets of VBA codes would be very similar. That doesn't seem to be the case. Looks like I'll have to recreate each macro.

Does anyone know of a converter for Excel VBA to Calc VBA?
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64

My Computers

System One System Two

  • Computer type
    Laptop
    Computer Manufacturer/Model Number
    Toshiba satellite C650D
    OS
    Windows 7 Home Premium x64
    CPU
    AMD V120
    Memory
    4GB
    Internet Speed
    150 Mbps
    Antivirus
    MSE
    Browser
    IE11, Edge, Firefox
    Other Info
    I also have W7 Pro on my System Two, and several W7 Hyper-V VMs. My other machines run Windows 10/11. Their specs are in my Ten Forums & Eleven Forum profiles.
  • Computer type
    Laptop
    System Manufacturer/Model Number
    Lenovo Thinkpad T430
    OS
    Windows 7 Pro x64
    CPU
    Intel i5-3320M
    Memory
    8 GB
    Hard Drives
    250GB Samsung SSD 860 EVO
    Antivirus
    MSE
Considering how complicated the VBA macro code is in LibreOffice, I've decided to stay with MS Office, at least for now. I'm very much surprised that its coding is not more closely aligned with that of MS Office.

Thanks for your replies.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
VBA is I believe still copywrite software, so it could be that companies / groups or individuals that are not able to licence VBA for use in their free software, would turn to one of the open source "BASIC" type languages to perform programmed tasks in their office suites
 

My Computers

System One System Two

  • Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
The easiest way to fix LibreOffice problems is to switch to OpenOffice
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Hewlett-Packard Presario C700 Notebook PC F.08
OS
Windows 7 Home 32 bit
CPU
1.47 gigahertz Intel Pentium Dual T2310
Motherboard
Hewlett-Packard 30D9 83.19
Memory
2gb
Graphics Card(s)
Integrated
Sound Card
Integrated
Monitor(s) Displays
Built-in
Screen Resolution
1600x900
Hard Drives
WDC WD3200BEKT-00PVMT0 [Hard drive] (320.07 GB) -- drive 0, s/n WD-WX11AC050066, rev 01.01A01, SMART Status: Healthy
Internet Speed
15mbps
Antivirus
Windows defender
Browser
Google chrome
Thanks for the tip. I'll give Open Office a try and see how it compares.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Thanks for the tip. I'll give Open Office a try and see how it compares.




The two are almost identical, in fact LibreOffice is a fork of OpenOffce when it looked like OpenOffice was about to die off. That didn't happen, but to this day OpenOffice is in less active development than LibreOffice, tending to lag behind in both features and support.


One of the biggest differences between Apache OpenOffice and LibreOffice is the frequency of releases. LibreOffice is updated much more frequently than Apache OpenOffice, which means you'll receive new features and bug fixes more quickly...

...Although both LibreOffice and Apache OpenOffice can open and edit native Microsoft formats DOCX and XLSX, only LibreOffice is able to save to these formats.
Libreoffice vs OpenOffice | TechRadar
 

My Computers

System One System Two

  • Computer type
    Laptop
    Computer Manufacturer/Model Number
    Toshiba satellite C650D
    OS
    Windows 7 Home Premium x64
    CPU
    AMD V120
    Memory
    4GB
    Internet Speed
    150 Mbps
    Antivirus
    MSE
    Browser
    IE11, Edge, Firefox
    Other Info
    I also have W7 Pro on my System Two, and several W7 Hyper-V VMs. My other machines run Windows 10/11. Their specs are in my Ten Forums & Eleven Forum profiles.
  • Computer type
    Laptop
    System Manufacturer/Model Number
    Lenovo Thinkpad T430
    OS
    Windows 7 Pro x64
    CPU
    Intel i5-3320M
    Memory
    8 GB
    Hard Drives
    250GB Samsung SSD 860 EVO
    Antivirus
    MSE
A follow up...

I tried OpenOffice and was not impressed. I think I'd go back to LibreOffice vs OpenOffice, if I decide to abandon MS Office.

Getting back to macros, one more question if I may: In Excel, when I select the 'view macro' option, the resulting Macro box shows all the macros. In LibreOffice, I have to hunt for them. Is there a way to ensure that all the workbook macros are in the same place and the 'run macro' selection goes to that place?
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top