Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello,

I have developed large and complex macros in VBA for MS Word, which work in
all versions of Word, from 97 to 2007, and people have asked me if they can
run in Open Office.

I did some research, and read that LibreOffice is better able to run VBA
macros than Open Office is.

Can someone please point me to anything that documents this statement.

Also, are there any scripts that will convert VBA for Word to LibreOffice
macros?

I have tried to run one of these VBA macros in LibreOffice Writer, but it
came to an error after just a few statements. Here's the first bit of code:
   InstallDoc = ActiveDocument
   InstallDocName = ActiveDocument.Name
   Set fs = CreateObject("Scripting.FileSystemobject")
   CurrentPath = ThisDocument.Path & Application.PathSeparator
The first three statements cause no error, but the fourth one complains about
   Application.PathSeparator

I have also recorded a macro and looked at it, and I must say the Basic
language statements recorded seem *much* more cumbersome than the code
produced by the VBA recorder. For example, here is a Hello World macro that
the recorder made:
<<<<<
sub Hello2
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Text"
args1(0).Value = "Hello again"

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
end sub


Much more complicated than VBA's recorder produced:
<<<
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/31/2011 by Jim Henderson
'
   Selection.TypeText Text:="Hello again"
End Sub


Is there any move to simplify the way LO macros do things?

Thanks for listening and thinking about these things,
   Jim


--
Unsubscribe instructions: E-mail to users+help@libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/www/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.