Ask Your Question
0

How to use VBS to manage Calc files? [closed]

asked 2016-03-18 13:41:11 +0200

kokbira gravatar image

updated 2020-07-24 00:37:18 +0200

Alex Kemp gravatar image

I am learning VBS scripts and someone gave me a code below, that works with Microsoft Excel. How to convert it to works with LibreOffice Calc?

Dim ObjExcel 
Call ExcelSetup("Sheet1")

Sub ExcelSetup(sheetName)
  Set objExcel = CreateObject("Excel.Application") 
  Set objwb = objExcel.Workbooks.Add 
  Set objwb = objExcel.ActiveWorkbook.Worksheets(sheetName) 

  Objwb.Name = "Sheet name for user"
  objwb.Activate 
  objExcel.Visible = True 
  objwb.Cells(1, 2).Value = "Hello world!" 
End Sub 

MsgBox "The End"
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-07-24 00:38:02.180491

1 Answer

Sort by » oldest newest most voted
0

answered 2018-05-08 22:30:58 +0200

OSS-user gravatar image

updated 2018-05-08 22:31:35 +0200

I suggest you, to forget MS VBA, and learn LO Basic scripting. The syntax is really same, not for all functions, but almost all the same. You can start looking in: LibreOffice Basic Programmer's Guide - Ask LibreOffice Don't expect, that copy-pasting works without doubt, you will still need to adjust MS VBA to LO Basic.

P.S. I saw, that you got answer on Stackexchange. Try looking for older question, but relevant to you: https://ask.libreoffice.org/en/questi...

edit flag offensive delete link more

Comments

Just a note: VBS != VBA.

Mike Kaganski gravatar imageMike Kaganski ( 2018-05-08 22:35:12 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-18 13:41:11 +0200

Seen: 1,370 times

Last updated: May 08 '18