This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
vba:functions:printlist [25.02.2016 12:31:51] yaslaw |
vba:functions:printlist [04.09.2019 11:56:42] (current) yaslaw |
||
---|---|---|---|
Line 1: | Line 1: | ||
<const> | <const> | ||
- | version=1.0.0 | + | version=1.1.1 |
- | vdate=02.02.2016 | + | vdate=04.09.2019 |
fname=udf_printlist.bas | fname=udf_printlist.bas | ||
ns=%NAMESPACE% | ns=%NAMESPACE% | ||
Line 19: | Line 19: | ||
===== Definitionen ===== | ===== Definitionen ===== | ||
- | <code>printList(DataArray [,HeaderArray [,ReturnOptionen]])</code> | + | <code>printList(DataArray [,HeaderArray [,ReturnOptionen [,FormatArray]]])</code> |
<code vb>Public Function printList( _ | <code vb>Public Function printList( _ | ||
ByRef iData As Variant, _ | ByRef iData As Variant, _ | ||
Optional ByRef iHeader As Variant = Null, _ | Optional ByRef iHeader As Variant = Null, _ | ||
- | Optional ByVal iReturn As enuPrintListOutputMethode = prListConsole _ | + | Optional ByVal iReturn As enuPrintListOutputMethode = prListConsole, _ |
+ | Optional ByRef iFormats As Variant = Null _ | ||
) As String</code> | ) As String</code> | ||
+ | ***iData** Array<Array<Variant>> Ein verschachtelter Array. Array<Zeilen<Werte>> | ||
+ | ***iHeader** Array<String> Ein Array mit dem Header | ||
+ | ***iReturn** enuPrintListOutputMethode Art der Rückgabe: Standart ist das Direktfenster. Alternativ kann man auch als Rückgabewert der Funktion oder in den Zwieschnepseicher des PCs schreiben. Die Auswahlen lassen sich auch kombinieren: prConsole+prClipboard | ||
+ | ***iFormats** Ein Array mit dFormaten um die Daten zu formatieren. Siehe auch format() von VBA | ||
+ | ***Return** String Resultat oder Fehlermeldung | ||
+ | |||
+ | ==== Enumerator ==== | ||
+ | === enuPrintListOutputMethode === | ||
+ | |||
+ | Auswahl was mir der Analyse geschehen soll. Die Werte lassen sich mit + kombinieren | ||
+ | ***prListConsole**(1) Die Ausgabe wird ins Direktfenster geschrieben | ||
+ | ***prListReturn**(2) Die Ausgabe wird als Funktionsrückgabewert zurückgegeben | ||
+ | ***prListClipboard**(4) Die Ausgabe wird in den Zwieschenspeicher geschrieben | ||
+ | ***prListMsgBox**(8) Die Ausgabe wird als Popup ausgegeben | ||
+ | | ||
===== Settings ===== | ===== Settings ===== | ||
Das Modul hat eine Kompilierbedinung. MS Access kennt den Befehl NZ(), MS Excel kennt den nicht. Um in Excel den Befehl zu verwenden habe ich die NZ-Funktion nachgebaut und in eine Bedingte Komplilierung gesetzt. Darum muss am Anfang vom Code eingestellt werden, ob der CODE unter MS Access läuft oder nicht | Das Modul hat eine Kompilierbedinung. MS Access kennt den Befehl NZ(), MS Excel kennt den nicht. Um in Excel den Befehl zu verwenden habe ich die NZ-Funktion nachgebaut und in eine Bedingte Komplilierung gesetzt. Darum muss am Anfang vom Code eingestellt werden, ob der CODE unter MS Access läuft oder nicht | ||
Line 55: | Line 71: | ||
===== Beispiele ===== | ===== Beispiele ===== | ||
+ | Das Beispiel macht so natürlich keinen Sinn, zeigt aber wie der Aufbaeu der Parameter sein muss | ||
+ | <code vb>printlist array(array(1,2,3, date()), array(11,22,33, date()+1)), array("A", "B", "C", "D") | ||
+ | A | B | C | D | ||
+ | ---|----|----|----------- | ||
+ | 1 | 2 | 3 | 29.02.2016 | ||
+ | 11 | 22 | 33 | 01.03.2016</code> | ||
+ | |||
+ | Ein Beispiel ohne Header, dafür ist die 2te Spalte formatiert | ||
+ | <code vb>printlist array(array(1, 2, "abc"), array(1.5, 2345.6, null)),,,array(,"#,##0.00") | ||
+ | 1 | 2.00 | abc | ||
+ | 1.5 | 2'345.60 | </code> | ||
+ | Einweiteres Beispiel ist die Funktion [[vba:functions:printref]]. | ||
===== Code ===== | ===== Code ===== | ||
<source '%%fpath%%/%%fname%%' vb> | <source '%%fpath%%/%%fname%%' vb> |