PDA

View Full Version : Excel Macro Functions (GET.DOCUMENT)



Admin
05-17-2011, 09:03 AM
Hi All,


Syntax

GET.DOCUMENT(type_num, name_text)
Type_num is a number that specifies what type of information you want. The following lists show the possible values of type_num and the corresponding results.

Type_num Returns

1 If there is more than one sheet in the workbook, returns the name of the worksheet, as text, in the form "[book1]sheet1". Otherwise, returns only the name of the workbook. The workbook name does not include the drive, directory or folder, or window number. It is usually best to use GET.DOCUMENT(76) and GET.DOCUMENT(88) to return the name of the active worksheet and the active workbook.
2 Path of the directory or folder containing name_text, as text. If the workbook name_text hasn't been saved yet, returns the #N/A error value.
3 Number indicating the type of sheet. If name_text is a sheet, then the return value is one of the following numbers. If name_text is a book, then the return value is always 5. If name_text is omitted, then the sheet type is returned. If the book has one sheet that is named the same as the book, then the sheet type is returned.
1 = Worksheet
2 = Chart
3 = Macro sheet
4 = Info window if active
5 = Reserved
6 = Module
7 = Dialog

4 If changes have been made to the sheet since it was last saved, returns TRUE; otherwise, returns FALSE.
5 If the sheet is read-only, returns TRUE; otherwise, returns FALSE.
6 If the sheet is password protected, returns TRUE; otherwise, returns FALSE.
7 If cells in a sheet, the contents of a sheet, or the series in a chart are protected, returns TRUE; otherwise, returns FALSE.
8 If the workbook windows are protected, returns TRUE; otherwise, returns FALSE.

The next four values of type_num apply only to charts.

Type_num Returns

9 Number indicating the type of the main chart:
1 = Area
2 = Bar
3 = Column
4 = Line
5 = Pie
6 = XY (scatter)
7 = 3-D area
8 = 3-D column
9 = 3-D line
10 = 3-D pie
11 = Radar
12 = 3-D bar
13 = 3-D surface
14 = Donut
10 Number indicating the type of the overlay chart. Same as 1, 2, 3, 4, 5, 6, 11, and 14 for main chart above. If there is no overlay chart, returns the #N/A error value.
11 Number of series in the main chart.
12 Number of series in the overlay chart.

The next values of type_num apply to worksheets and macro sheets and to charts when appropriate.

Type_num Returns

9 Number of the first used row. If the document is empty, returns 0.
10 Number of the last used row. If the document is empty, returns 0.
11 Number of the first used column. If the document is empty, returns 0.
12 Number of the last used column. If the document is empty, returns 0.
13 Number of windows.
14 Number indicating calculation mode:
1 = Automatic
2 = Automatic except tables
3 = Manual
15 If the Iteration check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
16 Maximum number of iterations.
17 Maximum change between iterations.
18 If the Update Remote References check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
19 If the Precision As Displayed check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
20 If the 1904 Date System check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.

Type_num values of 21 through 29 correspond to the four default fonts in previous versions of Microsoft Excel. These values are provided only for macro compatibility.
The next values of type_num apply to worksheets and macro sheets, and to charts if indicated.

Type_num Returns

30 Horizontal array of consolidation references for the current sheet, in the form of text. If the list is empty, returns the #N/A error value.
31 Number from 1 to 11, indicating the function used in the current consolidation. The function that corresponds to each number is listed under the CONSOLIDATE function. The default function is SUM.
32 Three-item horizontal array indicating the status of the check boxes in the Data Consolidate dialog box. An item is TRUE if the check box is selected or FALSE if the check box is cleared. The first item indicates the Top Row check box, the second the Left Column check box, and the third the Create Links To Source Data check box.
33 If the Recalculate Before Saving check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
34 If the workbook is read-only recommended, returns TRUE; otherwise, returns FALSE.
35 If the workbook is write-reserved, returns TRUE; otherwise, returns FALSE.

36 If the document has a write-reservation password and it is opened with read/write permission, returns the name of the user who originally saved the file with the write-reservation password. If the file is opened as read-only, or if a password has not been added to the document, returns the name of the current user.
37 Number corresponding to the file type of the document as displayed in the Save As dialog box. See the SAVE.AS function for a list of all the file types that Microsoft Excel recognizes.
38 If the Summary Rows Below Detail check box is selected in the Outline dialog box, returns TRUE; otherwise, returns FALSE.
39 If the Summary Columns To Right Of Detail check box is selected in the Outline dialog box, returns TRUE; otherwise, returns FALSE.
40 If the Create Backup File check box is selected in the Save As dialog box, returns TRUE; otherwise, returns FALSE.

41 Number from 1 to 3 indicating whether objects are displayed:
1 = All objects are displayed
2 = Placeholders for pictures and charts
3 = All objects are hidden
42 Horizontal array of all objects in the sheet. If there are no objects, returns the #N/A error value.
43 If the Save External Link Values check box is selected in the Calculation tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
44 If objects in a document are protected, returns TRUE; otherwise, returns FALSE.
45 A number from 0 to 3 indicating how windows are synchronized:
0 = Not synchronized
1 = Synchronized horizontally
2 = Synchronized vertically
3 = Synchronized horizontally and vertically
46 A seven-item horizontal array of print settings that can be set by the LINE.PRINT macro function:
- Setup text
- Left margin
- Right margin
- Top margin

- Bottom margin
- Page length
- A logical value indicating whether output will be formatted (TRUE) or unformatted (FALSE) when printed
47 If the Transition Expression Evaluation check box is selected in the Transition tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
48 The standard column width setting.

The next values of type_num correspond to printing and page settings.

to be continued....

Admin
05-17-2011, 09:04 AM
Type_num Returns

49 The starting page number, or the #N/A error value if none is specified or if "Auto" is entered in the First page Number text box on the Page tab of the Page Setup dialog box.
50 The total number of pages that would be printed based on current settings, excluding notes, or 1 if the document is a chart.
51 The total number of pages that would be printed if you print only notes, or the #N/A error value if the document is a chart.
52 Four-item horizontal array indicating the margin settings (left, right, top, bottom) in the currently specified units.
53 A number indicating the orientation:
1 = Portrait
2 = Landscape
54 The header as a text string, including formatting codes.
55 The footer as a text string, including formatting codes.
56 Horizontal array of two logical values corresponding to horizontal and vertical centering.
57 If row or column headings are to be printed, returns TRUE; otherwise, returns FALSE.

58 If gridlines are to be printed, returns TRUE; otherwise, returns FALSE.
59 If the sheet is printed in black and white only, returns TRUE; otherwise, returns FALSE.
60 A number from 1 to 3 indicating how the chart will be sized when it's printed:
1 = Size on screen
2 = Scale to fit page
3 = Use full page
61 A number indicating the pagination order:
1 = Down, then Over
2 = Over, then Down
Returns the #N/A error value if the document is a chart.
62 Percentage of reduction or enlargement, or 100% if none is specified. Returns the #N/A error value if not supported by the current printer or if the document is a chart.
63 A two-item horizontal array indicating the number of pages to which the printout should be scaled to fit, with the first item equal to the width (or #N/A if no width scaling is specified) and the second item equal to the height (or #N/A if no height scaling is specified). #N/A is also returned if the document is a chart.

64 An array of row numbers corresponding to rows that are immediately below a manual or automatic page break.
65 An array of column numbers corresponding to columns that are immediately to the right of a manual or automatic page break.

Note GET.DOCUMENT(62) and GET.DOCUMENT(63) are mutually exclusive. If one returns a value, then the other returns the #N/A error value.

The next values of type_num correspond to various document settings.

Type_num Returns

66 In Microsoft Excel for Windows, if the Transition Formula Entry check box is selected in the Transition tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.
67 Microsoft Excel 5.0 always returns TRUE here.
68 Microsoft Excel 5.0 always returns the book name.
69 Returns TRUE if Automatic Page Breaks is chosen in the View tab of the Options dialog box; otherwise, returns FALSE.
70 Returns the names of all the PivotTables in the document.
71 Returns an horizontal array of all the styles in a document.
72 Returns an horizontal array of all chart types displayed on the current sheet.
73 Returns an array of the number of series in each chart of the current sheet.
74 Returns the object id of the control that currently has the focus on a running user-defined dialog (based on the dialog sheet).

75 Returns the object id of the object that is the current default button on a running user-defined dialog (based on the dialog sheet).
76 Returns the name of the active sheet or macro sheet in the form [Book1]Sheet1.
77 Returns the paper size, as integer:
1 = Letter 8.5 x 11 in
2 = Letter Small 8.5 x 11 in
5 = Legal 8.5 x 14 in
9 = A4 210 x 297 mm
10 = A4 Small 210 x 297 mm
13 = B5 182 x 257 mm
18 = Note 8.5 x 11 in
78 Returns the print resolution, as a horizontal array of two numbers.
79 Returns TRUE if the Draft Quality check box has been selected from the sheet tab in the Page Setup dialog box; otherwise, returns FALSE.
80 Returns TRUE if the Notes checkbox has been selected on the Sheet tab in the Page Setup dialog box; otherwise, returns FALSE.

81 Returns the print area from the Sheet tab of the Page Setup dialog box as a cell reference.
82 Returns the print titles from the Sheet tab of the Page Setup dialog box as an array of cell references.
83 Returns TRUE if the worksheet is protected for scenarios; otherwise, returns FALSE.
84 Returns the value of the first circular reference on the sheet, or #N/A if there are no circular references.
85 Returns the advanced filter mode state of the sheet. This is the mode without drop-down arrows on top. Returns TRUE if the list has been filtered by choosing Filter, then Advanced Filter from the Data menu. Otherwise, returns FALSE.
86 Returns the automatic filter mode state of the sheet. This is the mode with drop-down arrows on top. Returns TRUE if you have chosen Filter, then AutoFilter from the Data menu and the filter drop-down arrows are displayed. Otherwise, returns FALSE.

87 Returns the position number of the sheet. The first sheet is position 1. Hidden sheet are included in the count.
88 Returns the name of the active workbook in the form "Book1".

Name_text is the name of an open document. If name_text is omitted, it is assumed to be the active document.

Excel Fox
06-29-2011, 08:10 PM
And example would be when you would want to SUM across Multiple Worksheets When There Is An Error (http://www.ozgrid.com/forum/showthread.php?t=151223)

Here's another site that provides info on XLM functions in Excel

http://www.jkp-ads.com/articles/excelnames08.asp


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugz-pow-E8FDG8gFZ4l4AaABAg.9f8Bng22e5d9f8hoJGZY-5 (https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugz-pow-E8FDG8gFZ4l4AaABAg.9f8Bng22e5d9f8hoJGZY-5)
https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxev2gQt7BKZ0WYMfh4AaABAg.9f6hAjkC0ct9f8jleOui-u (https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxev2gQt7BKZ0WYMfh4AaABAg.9f6hAjkC0ct9f8jleOui-u)
https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxg9iT7MPWGBWruIzR4AaABAg (https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxg9iT7MPWGBWruIzR4AaABAg)
https://www.youtube.com/watch?v=tzbKqTRuRzU&lc=UgyYW2WZ2DvSrzUKnJ14AaABAg (https://www.youtube.com/watch?v=tzbKqTRuRzU&lc=UgyYW2WZ2DvSrzUKnJ14AaABAg)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)