This article is rated Stub-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||
|
Look at http://wiki.services.openoffice.org/wiki/Extensions_development_basic even though it is all about OpenOffice.org Basic I assume it is similar to StarOffice Basic. Jebix 02:55, 6 July 2006 (UTC)
If they are one and the same why are there 2 names ?? 202.138.120.38 ( talk) 09:22, 2 April 2010 (UTC)
It would perhaps be more useful if both a VBA and OOoBasic version were given to show the differences, rather than a single "look how different this is" piece of code. It may be obvious to some, but to mere mortals like me, it doesn't mean very much. -- Yendor1958 09:17, 13 July 2007 (UTC)
Well I did a Google search for a VBA macro that does the same (count the paragraphs) and this is what I found:
Sub ParagraphCount()
' To Display the Total Number of Paragraphs in a document.
Dim AD As Document
Dim DP As Object
Set AD = ActiveDocument
Set DP = AD.BuiltInDocumentProperties
' Returns the number of paragraphs in a document.
MsgBox "There are " & AD.Paragraphs.Count & " paragraphs."
End Sub
I think it would be an unfair comparison to the current StarBasic code, and actually the paragraph count is readily available through the OpenOffice.org API as well, so this could be the StarBasic equivalent:
Sub ParagraphCount()
' To Display the Total Number of Paragraphs in a document.
Dim AD As Object
Set AD = ThisComponent
' Returns the number of paragraphs in a document.
MsgBox "There are " & AD.ParagraphCount & " paragraphs."
End Sub
I have tested the StarBasic macro and it works. I hope the VBA macro works too (it is from http://support.microsoft.com/kb/211455). The difference in the APIs is now that the current document can be accessed via "ActiveDocument" vs "ThisComponent" and in Word the paragraph count is accessed quite differently (through a number of indirections) from OpenOffice.org (where it is a directly accessible property of the document). -- CyHawk ( talk) 13:46, 17 February 2009 (UTC)
I don't think that this article should have a piece of example code above the table of contents, shouldn't there be an example section where such code is displayed? — Odin_son 15:21, 10 November 2010 (UTC)
Is TextEl (first appearing in WHILE loop) an implicit declaration of variable? Or something different? It is rendered black, so I had such an impression. -- 81.198.35.190 ( talk) 11:46, 21 May 2012 (UTC)
<syntaxhighlight lang="oobas"> is properly not working. The new GeSHi extension doesn't support "oobas" syntax. See https://github.com/wikimedia/mediawiki-extensions-SyntaxHighlight_GeSHi/blob/master/SyntaxHighlight_GeSHi.lexers.php -- Cedar101 ( talk) 00:29, 4 August 2015 (UTC)
This article is rated Stub-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||
|
Look at http://wiki.services.openoffice.org/wiki/Extensions_development_basic even though it is all about OpenOffice.org Basic I assume it is similar to StarOffice Basic. Jebix 02:55, 6 July 2006 (UTC)
If they are one and the same why are there 2 names ?? 202.138.120.38 ( talk) 09:22, 2 April 2010 (UTC)
It would perhaps be more useful if both a VBA and OOoBasic version were given to show the differences, rather than a single "look how different this is" piece of code. It may be obvious to some, but to mere mortals like me, it doesn't mean very much. -- Yendor1958 09:17, 13 July 2007 (UTC)
Well I did a Google search for a VBA macro that does the same (count the paragraphs) and this is what I found:
Sub ParagraphCount()
' To Display the Total Number of Paragraphs in a document.
Dim AD As Document
Dim DP As Object
Set AD = ActiveDocument
Set DP = AD.BuiltInDocumentProperties
' Returns the number of paragraphs in a document.
MsgBox "There are " & AD.Paragraphs.Count & " paragraphs."
End Sub
I think it would be an unfair comparison to the current StarBasic code, and actually the paragraph count is readily available through the OpenOffice.org API as well, so this could be the StarBasic equivalent:
Sub ParagraphCount()
' To Display the Total Number of Paragraphs in a document.
Dim AD As Object
Set AD = ThisComponent
' Returns the number of paragraphs in a document.
MsgBox "There are " & AD.ParagraphCount & " paragraphs."
End Sub
I have tested the StarBasic macro and it works. I hope the VBA macro works too (it is from http://support.microsoft.com/kb/211455). The difference in the APIs is now that the current document can be accessed via "ActiveDocument" vs "ThisComponent" and in Word the paragraph count is accessed quite differently (through a number of indirections) from OpenOffice.org (where it is a directly accessible property of the document). -- CyHawk ( talk) 13:46, 17 February 2009 (UTC)
I don't think that this article should have a piece of example code above the table of contents, shouldn't there be an example section where such code is displayed? — Odin_son 15:21, 10 November 2010 (UTC)
Is TextEl (first appearing in WHILE loop) an implicit declaration of variable? Or something different? It is rendered black, so I had such an impression. -- 81.198.35.190 ( talk) 11:46, 21 May 2012 (UTC)
<syntaxhighlight lang="oobas"> is properly not working. The new GeSHi extension doesn't support "oobas" syntax. See https://github.com/wikimedia/mediawiki-extensions-SyntaxHighlight_GeSHi/blob/master/SyntaxHighlight_GeSHi.lexers.php -- Cedar101 ( talk) 00:29, 4 August 2015 (UTC)