From 1268046a80406823e8a43e95738f1869e371821b Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Fri, 19 May 2017 11:12:14 -0300 Subject: tdf#84675 Help VBA functions AscW, ChrW, InStrRev These functions are enabled whith Option VBASupport 1 fix bookmark Fix metas Fix makefile & add InStrRev Bookmarking Fix category for DDB Change-Id: I12fed1cd521ffb846d2994323013e8dcc127381f Reviewed-on: https://gerrit.libreoffice.org/37826 Reviewed-by: Olivier Hallot Tested-by: Olivier Hallot (cherry picked from commit eb145d19480d245228dc6b1032a925adbff8ea78) Reviewed-on: https://gerrit.libreoffice.org/37838 --- AllLangHelp_sbasic.mk | 4 + source/text/sbasic/shared/00000003.xhp | 682 ++++++++++--------------- source/text/sbasic/shared/03120111.xhp | 72 +++ source/text/sbasic/shared/03120112.xhp | 72 +++ source/text/sbasic/shared/03120411.xhp | 80 +++ source/text/sbasic/shared/main0601.xhp | 4 +- source/text/sbasic/shared/special_vba_func.xhp | 160 ++++++ source/text/sbasic/shared/vbasupport.xhp | 5 +- 8 files changed, 676 insertions(+), 403 deletions(-) create mode 100644 source/text/sbasic/shared/03120111.xhp create mode 100644 source/text/sbasic/shared/03120112.xhp create mode 100644 source/text/sbasic/shared/03120411.xhp create mode 100644 source/text/sbasic/shared/special_vba_func.xhp diff --git a/AllLangHelp_sbasic.mk b/AllLangHelp_sbasic.mk index 1be0b6bbea..48e8ca7668 100644 --- a/AllLangHelp_sbasic.mk +++ b/AllLangHelp_sbasic.mk @@ -277,6 +277,8 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\ helpcontent2/source/text/sbasic/shared/03120103 \ helpcontent2/source/text/sbasic/shared/03120104 \ helpcontent2/source/text/sbasic/shared/03120105 \ + helpcontent2/source/text/sbasic/shared/03120111 \ + helpcontent2/source/text/sbasic/shared/03120112 \ helpcontent2/source/text/sbasic/shared/03120200 \ helpcontent2/source/text/sbasic/shared/03120201 \ helpcontent2/source/text/sbasic/shared/03120202 \ @@ -300,6 +302,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\ helpcontent2/source/text/sbasic/shared/03120401 \ helpcontent2/source/text/sbasic/shared/03120402 \ helpcontent2/source/text/sbasic/shared/03120403 \ + helpcontent2/source/text/sbasic/shared/03120411 \ helpcontent2/source/text/sbasic/shared/03130000 \ helpcontent2/source/text/sbasic/shared/03130100 \ helpcontent2/source/text/sbasic/shared/03130500 \ @@ -325,6 +328,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\ helpcontent2/source/text/sbasic/shared/keys \ helpcontent2/source/text/sbasic/shared/main0211 \ helpcontent2/source/text/sbasic/shared/main0601 \ + helpcontent2/source/text/sbasic/shared/special_vba_func \ helpcontent2/source/text/sbasic/shared/vbasupport \ )) diff --git a/source/text/sbasic/shared/00000003.xhp b/source/text/sbasic/shared/00000003.xhp index 0035ea6609..530de72682 100644 --- a/source/text/sbasic/shared/00000003.xhp +++ b/source/text/sbasic/shared/00000003.xhp @@ -1,6 +1,5 @@ - - + +--> - - -Information -/text/sbasic/shared/00000003.xhp - - -Sun Microsystems, Inc. - + + Information + /text/sbasic/shared/00000003.xhp + + -Information + + +Information +
-You can set the locale used for controlling the formatting numbers, dates and currencies in $[officename] Basic in %PRODUCTNAME - PreferencesTools - Options - Language Settings - Languages. In Basic format codes, the decimal point (.) is always used as placeholder for the decimal separator defined in your locale and will be replaced by the corresponding character. -The same applies to the locale settings for date, time and currency formats. The Basic format code will be interpreted and displayed according to your locale setting. +You can set the locale used for controlling the formatting numbers, dates and currencies in $[officename] Basic in %PRODUCTNAME - Preferences +Tools - Options - Language Settings - Languages. In Basic format codes, the decimal point (.) is always used as placeholder for the decimal separator defined in your locale and will be replaced by the corresponding character. +The same applies to the locale settings for date, time and currency formats. The Basic format code will be interpreted and displayed according to your locale setting.
+
-The color values of the 16 basic colors are as follows: +The color values of the 16 basic colors are as follows: + - - - -Color Value - - - - -Color Name - - - - - -0 - - -Black - - - - -128 - - -Blue - - - - -32768 - - -Green - - - - -32896 - - -Cyan - - - - -8388608 - - -Red - - - - -8388736 - - -Magenta - - - - -8421376 - - -Yellow - - - - -8421504 - - -White - - - - -12632256 - - -Gray - - - - -255 - - -Light blue - - - - -65280 - - -Light green - - - - -65535 - - -Light cyan - - - - -16711680 - - -Light red - - - - -16711935 - - -Light magenta - - - - -16776960 - - -Light yellow - - - - -16777215 - - -Transparent white - - + + + Color Value + + + Color Name + + + + + 0 + + + Black + + + + + 128 + + + Blue + + + + + 32768 + + + Green + + + + + 32896 + + + Cyan + + + + + 8388608 + + + Red + + + + + 8388736 + + + Magenta + + + + + 8421376 + + + Yellow + + + + + 8421504 + + + White + + + + + 12632256 + + + Gray + + + + + 255 + + + Light blue + + + + + 65280 + + + Light green + + + + + 65535 + + + Light cyan + + + + + 16711680 + + + Light red + + + + + 16711935 + + + Light magenta + + + + + 16776960 + + + Light yellow + + + + + 16777215 + + + Transparent white + +
+ + +
+This function is enabled with the statement Option VBASupport 1 placed before the executable program code in a module. +
+
-Error Codes - +Error Codes
+
-1 An exception occurred - -2 Syntax error - -3 Return without Gosub - -4 Incorrect entry; please retry - -5 Invalid procedure call - -6 Overflow - -7 Not enough memory - -8 Array already dimensioned - -9 Index out of defined range - -10 Duplicate definition - -11 Division by zero - -12 Variable not defined - -13 Data type mismatch - -14 Invalid parameter - -18 Process interrupted by user - -20 Resume without error - -28 Not enough stack memory - -35 Sub-procedure or function procedure not defined - -48 Error loading DLL file - -49 Wrong DLL call convention - -51 Internal error - -52 Invalid file name or file number - -53 File not found - -54 Incorrect file mode - -55 File already open - -57 Device I/O error - -58 File already exists - -59 Incorrect record length - -61 Disk or hard drive full - -62 Reading exceeds EOF - -63 Incorrect record number - -67 Too many files - -68 Device not available - -70 Access denied - -71 Disk not ready - -73 Not implemented - -74 Renaming on different drives impossible - -75 Path/file access error - -76 Path not found - -91 Object variable not set - -93 Invalid string pattern - -94 Use of zero not permitted - -250 DDE Error - -280 Awaiting response to DDE connection - -281 No DDE channels available - -282 No application responded to DDE connect initiation - -283 Too many applications responded to DDE connect initiation - -284 DDE channel locked - -285 External application cannot execute DDE operation - -286 Timeout while waiting for DDE response - -287 user pressed ESCAPE during DDE operation - -288 External application busy - -289 DDE operation without data - -290 Data are in wrong format - -291 External application has been terminated - -292 DDE connection interrupted or modified - -293 DDE method invoked with no channel open - -294 Invalid DDE link format - -295 DDE message has been lost - -296 Paste link already performed - -297 Link mode cannot be set due to invalid link topic - -298 DDE requires the DDEML.DLL file - -323 Module cannot be loaded; invalid format - -341 Invalid object index - -366 Object is not available - -380 Incorrect property value - -382 This property is read-only - -394 This property is write-only - -420 Invalid object reference - -423 Property or method not found - -424 Object required - -425 Invalid use of an object - -430 OLE Automation is not supported by this object - -438 This property or method is not supported by the object - -440 OLE automation error - -445 This action is not supported by given object - -446 Named arguments are not supported by given object - -447 The current locale setting is not supported by the given object - -448 Named argument not found - -449 Argument is not optional - -450 Invalid number of arguments - -451 Object is not a list - -452 Invalid ordinal number - -453 Specified DLL function not found - -460 Invalid clipboard format - -951 Unexpected symbol: - -952 Expected: - -953 Symbol expected - -954 Variable expected - -955 Label expected - -956 Value cannot be applied - -957 Variable already defined - -958 Sub procedure or function procedure already defined - -959 Label already defined - -960 Variable not found - -961 Array or procedure not found - -962 Procedure not found - -963 Label undefined - -964 Unknown data type - -965 Exit expected - -966 Statement block still open: missing - -967 Parentheses do not match - -968 Symbol already defined differently - -969 Parameters do not correspond to procedure - -970 Invalid character in number - -971 Array must be dimensioned - -972 Else/Endif without If - -973 not allowed within a procedure - -974 not allowed outside a procedure - -975 Dimension specifications do not match - -976 Unknown option: - -977 Constant redefined - -978 Program too large - -979 Strings or arrays not permitted - -1000 Object does not have this property - -1001 Object does not have this method - -1002 Required argument lacking - -1003 Invalid number of arguments - -1004 Error executing a method - -1005 Unable to set property - -1006 Unable to determine property - +1 An exception occurred +2 Syntax error +3 Return without Gosub +4 Incorrect entry; please retry +5 Invalid procedure call +6 Overflow +7 Not enough memory +8 Array already dimensioned +9 Index out of defined range +10 Duplicate definition +11 Division by zero +12 Variable not defined +13 Data type mismatch +14 Invalid parameter +18 Process interrupted by user +20 Resume without error +28 Not enough stack memory +35 Sub-procedure or function procedure not defined +48 Error loading DLL file +49 Wrong DLL call convention +51 Internal error +52 Invalid file name or file number +53 File not found +54 Incorrect file mode +55 File already open +57 Device I/O error +58 File already exists +59 Incorrect record length +61 Disk or hard drive full +62 Reading exceeds EOF +63 Incorrect record number +67 Too many files +68 Device not available +70 Access denied +71 Disk not ready +73 Not implemented +74 Renaming on different drives impossible +75 Path/file access error +76 Path not found +91 Object variable not set +93 Invalid string pattern +94 Use of zero not permitted +250 DDE Error +280 Awaiting response to DDE connection +281 No DDE channels available +282 No application responded to DDE connect initiation +283 Too many applications responded to DDE connect initiation +284 DDE channel locked +285 External application cannot execute DDE operation +286 Timeout while waiting for DDE response +287 user pressed ESCAPE during DDE operation +288 External application busy +289 DDE operation without data +290 Data are in wrong format +291 External application has been terminated +292 DDE connection interrupted or modified +293 DDE method invoked with no channel open +294 Invalid DDE link format +295 DDE message has been lost +296 Paste link already performed +297 Link mode cannot be set due to invalid link topic +298 DDE requires the DDEML.DLL file +323 Module cannot be loaded; invalid format +341 Invalid object index +366 Object is not available +380 Incorrect property value +382 This property is read-only +394 This property is write-only +420 Invalid object reference +423 Property or method not found +424 Object required +425 Invalid use of an object +430 OLE Automation is not supported by this object +438 This property or method is not supported by the object +440 OLE automation error +445 This action is not supported by given object +446 Named arguments are not supported by given object +447 The current locale setting is not supported by the given object +448 Named argument not found +449 Argument is not optional +450 Invalid number of arguments +451 Object is not a list +452 Invalid ordinal number +453 Specified DLL function not found +460 Invalid clipboard format +951 Unexpected symbol: +952 Expected: +953 Symbol expected +954 Variable expected +955 Label expected +956 Value cannot be applied +957 Variable already defined +958 Sub procedure or function procedure already defined +959 Label already defined +960 Variable not found +961 Array or procedure not found +962 Procedure not found +963 Label undefined +964 Unknown data type +965 Exit expected +966 Statement block still open: missing +967 Parentheses do not match +968 Symbol already defined differently +969 Parameters do not correspond to procedure +970 Invalid character in number +971 Array must be dimensioned +972 Else/Endif without If +973 not allowed within a procedure +974 not allowed outside a procedure +975 Dimension specifications do not match +976 Unknown option: +977 Constant redefined +978 Program too large +979 Strings or arrays not permitted +1000 Object does not have this property +1001 Object does not have this method +1002 Required argument lacking +1003 Invalid number of arguments +1004 Error executing a method +1005 Unable to set property +1006 Unable to determine property
+
diff --git a/source/text/sbasic/shared/03120111.xhp b/source/text/sbasic/shared/03120111.xhp new file mode 100644 index 0000000000..7782582589 --- /dev/null +++ b/source/text/sbasic/shared/03120111.xhp @@ -0,0 +1,72 @@ + + + + + + + AscW Function [Runtime] + /text/sbasic/shared/03120111.xhp + + + + + + +
+ + AscW function + + + +AscW Function [Runtime - VBA] +Returns the Unicode value of the first character in a string expression. +
+ + +Syntax: + +AscW (Text As String) as Integer + + +Return value: +Integer + +Parameters: + Text: Any valid string expression. Only the first character in the string is relevant. +Use the AscW function to replace keys with Unicode values. If the AscW function encounters a blank string, %PRODUCTNAME Basic reports a run-time error. Returned values are between 0 and 65535. + + + +Example: + +Sub ExampleAscW + Print AscW("A") ' returns 65 + Print AscW("Ω") ' returns 937 + Print AscW("Αθήνα") ' returns 913, since only the first character (Alpha) is taken into account +End Sub + + +
+Chr +ChrW +Asc +
+ + +
diff --git a/source/text/sbasic/shared/03120112.xhp b/source/text/sbasic/shared/03120112.xhp new file mode 100644 index 0000000000..ee0c9828b5 --- /dev/null +++ b/source/text/sbasic/shared/03120112.xhp @@ -0,0 +1,72 @@ + + + + + + + ChrW Function [Runtime -VBA] + /text/sbasic/shared/03120112.xhp + + + + + + +
+ + ChrW function + + + +ChrW Function [Runtime -VBA] +Returns the Unicode character that corresponds to the specified character code. +
+ + +Syntax: + +ChrW(Expression As Integer) + + +Return value: +String + +Parameters: + Expression: Numeric variables that represent a valid 16 bit Unicode value (0-65535). An empty value returns error code 5. A value out of the range [0,65535] returns error code 6. + + + + +Example: + +Sub ExampleChrW + ' This example inserts the greek letter Alpha and Omega in a string. + MsgBox "From "+ ChrW(913)+" to " + ChrW(937) + ' The printout appears in the dialog as: From Α to Ω +End Sub + + +
+Chr +Asc +AscW +
+ + +
diff --git a/source/text/sbasic/shared/03120411.xhp b/source/text/sbasic/shared/03120411.xhp new file mode 100644 index 0000000000..ae0bd22e84 --- /dev/null +++ b/source/text/sbasic/shared/03120411.xhp @@ -0,0 +1,80 @@ + + + + + + + InStrRev Function [Runtime - VBA] + /text/sbasic/shared/03120411.xhp + + + + + + +
+ + InStrRev function + + + +InStrRev Function [Runtime - VBA] +Returns the position of a string within another string, starting from the right side of the string. +
+ +The InStrRev function returns the position at which the match was found, from the right. If the string was not found, the function returns 0. + +Syntax: + +InStrRev (Text1 As String, Text2 As String [,Start As Long] [, Compare As Integer]) As Long + + +Return value: +Long + +Parameters: + Text1: The string expression that you want to search. + Text2: The string expression that you want to search for. + Start: Optional numeric expression that marks the position from the left in a string where the search for the specified substring starts. If you omit this parameter, the search starts at the last character of the string. The maximum allowed value is 65535. + Compare: Optional numeric expression that defines the type of comparison. The value of this parameter can be +1: The default value of 1 specifies a text comparison that is not case-sensitive. +0: The value of 0 specifies a binary comparison that is case-sensitive. +To avoid a run-time error, do not set the Compare parameter if the first return parameter is omitted. + + + +Example: + +Sub ExamplePosition +Dim sInput As String +Dim iPos As Integer + sInput = "The book is on the table" + iPos = Instr(sInput,"the",10,1) ' Returns 1, search is case-insensitive + Print iPos + iPos = Instr(sInput,"the",10,0) ' Returns 0, search is case-sensitive + Print iPos +End Sub + + +
+InStr +
+ + +
\ No newline at end of file diff --git a/source/text/sbasic/shared/main0601.xhp b/source/text/sbasic/shared/main0601.xhp index e9e9e50160..728c76cb58 100644 --- a/source/text/sbasic/shared/main0601.xhp +++ b/source/text/sbasic/shared/main0601.xhp @@ -45,7 +45,9 @@ - + +Working with VBA Macros + Help about the Help diff --git a/source/text/sbasic/shared/special_vba_func.xhp b/source/text/sbasic/shared/special_vba_func.xhp new file mode 100644 index 0000000000..541870cea2 --- /dev/null +++ b/source/text/sbasic/shared/special_vba_func.xhp @@ -0,0 +1,160 @@ + + + + + + + Exclusive VBA functions + /text/sbasic/shared/special_vba_func.xhp + + + + + + +
+ + VBA Functions + + + +Exclusive VBA functions +%PRODUCTNAME Basic supports these functions when VBA support is enabled +
+The following VBA functions are enabled when Option VBASupport 1 is the first line of a %PRODUCTNAME Basic module. + + VBA Functions;Text Functions + + + +Text functions + + + + AscW + + + ChrW + + + InStrRev + + + StrReverse + + + VBA Functions;Financial Functions + + + +Financial functions + + + + DDB + + + FV + + + IPmt + + + IRR + + + MIRR + + + NPer + + + NPV + + + Pmt + + + PPmt + + + PV + + + Rate + + + SLN + + + SYD + + + VBA Functions;Date and Time Functions + + + +Date and time functions + + + + FormatDateTime + + + WeekdayName + + + VBA Functions;I/O Functions + + + +I/O Functions + + + + Input + + + VBA Functions;Mathematical Functions + + + +Mathematical Functions + + + + Round + + + VBA Functions;Object Functions + + + +Object Functions + + + + Me + + + RTL + + + +
\ No newline at end of file diff --git a/source/text/sbasic/shared/vbasupport.xhp b/source/text/sbasic/shared/vbasupport.xhp index 694afd33c8..4724bae843 100644 --- a/source/text/sbasic/shared/vbasupport.xhp +++ b/source/text/sbasic/shared/vbasupport.xhp @@ -29,8 +29,7 @@
- -Working with VBA Macros +Working with VBA Macros Visual Basic for Applications (VBA) is an implementation of Microsoft's Visual Basic which is built into all Microsoft Office applications.
Support for VBA is not complete, but it covers a large portion of the common usage patterns. Most macros use a manageable subset of objects in the Excel API (such as the Range, Worksheet, Workbook, etc.) and the support include those objects, and the most commonly used method/properties of those objects. @@ -52,4 +51,4 @@ -
\ No newline at end of file + -- cgit v1.2.3