Excel4.0マクロ GET.CELL 


http://qiita.com/Q11Q/items/b91609fc7d1f43848c7d
Excel4MacroのヘルプはWin10では開けないので調べてみましょう

#基本

[Excel VBA リファレンス＞オブジェクトモデル＞Applicationオブジェクト Application.ExecuteExcel4Macro メソッド (Excel)](https://msdn.microsoft.com/ja-jp/library/office/ff193589.aspx)
Office 2013 以降
Excel 4.0 マクロ関数を実行し、関数の結果を返します。値の取得および設定が可能です。取得する型の種類は、対象の関数によって異なります。

Excel 4.0 マクロ言語関数を等号 (=) なしで指定します。
***参照はすべて R1C1 の文字列として指定する必要があります。***
また、引数 String 内で二重引用符 (") を使うときは、二重引用符を続けて記述してください。たとえば、=MID("Microsoft Excel",11,5) というマクロ関数を実行するときは、引数 String には "MID(""Microsoft Excel"",11,5)" と指定します。

##注釈
Excel 4.0 のマクロは、ブックやシートの状況に応じては評価されません。したがって、参照は外部参照として、明示的にブック名を指定する必要があります。たとえば、ブック 1 の My_Macro という Excel 4.0 マクロを実行するときは、"Book1!My_Macro()" と指定します。ブック名を指定しないと、このメソッドは失敗します。

次の使用例は、シート 1 のセル C3 で GET.CELL(42) というマクロ関数を実行し、結果を表示します。GET.CELL(42) は、アクティブ ウィンドウの左端からアクティブ セルの左端までの水平距離を返します。このマクロ関数に相当する Visual Basic の関数はありません。
Worksheets("Sheet1").Activate
Range("C3").Select
MsgBox ExecuteExcel4Macro("GET.CELL(42)")
Option.List.Getで並べ替えのユーザー設定リストの最初の文字を返すマクロ

```vb:Excel4MacroOptionListGet
Sub Excel4MacroOptionListGet()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = ActiveSheet
Dim i As Long
On Error Resume Next
For i = 1 To 100
Debug.Print Application.ExecuteExcel4Macro("OPTIONS.LISTS.GET(" & i & ")") & " i:=" & i
If Err.Number <> 0 Then Debug.Print "err", Err.Number, Err.Description, " i:=" & i
Next
End Sub
```

### Get.Document

```vb:Excel4Macrotest
Sub Excel4Macrotest()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = ActiveSheet
Dim i As Long
On Error Resume Next
For i = 1 To 100
Debug.Print Application.ExecuteExcel4Macro("GET.Document(" & i & ")") & " i:=" & i
If Err.Number <> 0 Then Debug.Print "err", Err.Number, Err.Description, " i:=" & i
Next
End Sub
```
[ExecuteExcel4Macroについて - excel-ubara](http://excel-ubara.com/excelvba4/EXCEL219.html)
他ブックのデータを、ブックを開かずに取得する
Range("A1") = ExecuteExcel4Macro("'C:\Excel\[test.xls]Sheet1'!R1C2")
しかし、この場合は、１つづつのセルしか取得できません、複数セルを一括で取得できないです。

Range("A1") = ExecuteExcel4Macro("AVERAGE('C:\[test.xls]Sheet1'!R1C1:R10C1)")
文字列としての計算式を計算する。この機能は、代替えがありません。
Dim strCalc As String
strCalc = "(10+20)*2"
Range("A1") = ExecuteExcel4Macro("EVALUATE(" & strCalc & ")")

[ブックを開かずにセル値を取得（ExecuteExcel4Macro,Excel.Application）- excel-ubara](http://excel-ubara.com/excelvba5/EXCELVBA242.html)
結論として、ExecuteExcel4Macroが有用なのは、
・ファイル数が極めて多い
・シート名が固定されている
・取得するセル数が限定的である事
[Excel 2007 以降のバージョンで Application.ExecuteExcel4Macro("get.document(50)") を実行しても正しいページ数が取得できない](https://support.microsoft.com/ja-jp/help/2838848)
Microsoft Office Excel 2007 以降のバージョンで、図形等のオブジェクトが存在するシートに対して、Application.ExecuteExcel4Macro("get.document(50)") を実行しても、正しいページ数が取得できない場合があります。

##EXCEL 4.0 MacroはVBAに変換できるか?
[Convert Excel 4 macros to VBA - StackOverFlow]( https://stackoverflow.com/questions/90858/convert-excel-4-macros-to-vba)
ここで紹介されているのが以下のMSのページ
[Converting Code from VBA to Visual Basic .NET]( https://msdn.microsoft.com/en-us/library/aa192490.aspx)
現在のVBAに変換できるものが多いとされているが、ツールバー系は現在と仕様が違うため不明。

##EXCEL 4.0 Macroは引き続き使えるのか？
[Excel 4.0 マクロを操作する]( https://support.office.com/ja-jp/article/Excel-4-0-%e3%83%9e%e3%82%af%e3%83%ad%e3%82%92%e6%93%8d%e4%bd%9c%e3%81%99%e3%82%8b-BA8924D4-E157-4BB2-8D76-2C07FF02E0B8?ui=ja-JP&rs=ja-JP&ad=JP)

Excel2010のみ記載あり。~~Excel2007からタイトル変えているので使いまわしているだけなので引き続き使える。~~
まずいので取り消し線を引きました。

## リファレンスは日本語しか見つかっていない
[Excel4.0マクロ](http://excel4macro.blog86.fc2.com/)
日本語版のヘルプ
2008年に作られたもの

しかし、このヘルプには
[Excel 4.0 から変更があったマクロ関数一覧（コマンド対応関数以外)](https://support.microsoft.com/ja-jp/help/402616)
のExcel 5.0 の
Option.List.Get
など載っていないものがある

[Excel 4.0 から変更があったマクロ関数一覧（コマンド対応関数）]( https://support.microsoft.com/ja-jp/help/402375)
SET.PRINT.AREA
も載っていない。
しかし、実際は以下のようにExcel5.0マクロもExecute…で動いてしまう。
印刷範囲の定義
A1:C30を二重ダブルクォーテーションで囲む。

```vb:Macro5SetPrintArea
Sub Macro5SetPrintArea()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = ActiveSheet
Dim r As Range: Set r = ws.Range(ActiveCell.Address)
Application.ExecuteExcel4Macro ("SET.PRINT.AREA(""A1:C30"")")
Debug.Print ws.PageSetup.PrintArea
End Sub
```
```vb:Macro5OpenTxt
Sub Macro5OpenTxt()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = ActiveSheet
Dim r As Range: Set r = ws.Range(ActiveCell.Address)
Dim sFile As String
Dim sPath As String
sPath = "C:\Hoge\"
sFile = "hoge.csv"
With CreateObject("Scripting.FileSystemobject")
If .Fileexists(sPath & sFile) Then
Debug.Print "OK"
Application.ExecuteExcel4Macro ("OPEN.TEXT(" & Chr(34) & sPath & sFile & Chr(34) & ")")
End If
End With
End Sub
```
実行するとCSVファイルを新しいウィンドウに開く。シート名がファイル名になる。

###Get.Cell

```vb:Excel4MacroGetCell
Sub Excel4MacroGetCell()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = ActiveSheet
Dim i As Long
On Error Resume Next
For i = 1 To 100
Debug.Print Application.ExecuteExcel4Macro("GET.CELL(" & i & ")") & " i:=" & i
If Err.Number <> 0 Then Debug.Print "err", Err.Number, Err.Description, " i:=" & i
Next
End Sub

```

1	Absolute reference of the upper-left cell in reference, as text in the current workspace reference style.ブック名とシート名とセル絶対番地
2	Row number of the top cell in reference.
3	Column number of the leftmost cell in reference.
4	Same as TYPE(reference).
5	Contents of reference.
6	Formula in reference, as text, in either A1 or R1C1 style depending on the workspace setting.
7	Number format of the cell, as text (for example, "m/d/yy" or "General").
8	Number indicating the cell's horizontal alignment:
1 = General 
2 = Left 
3 = Center 
4 = Right 
5 = Fill
6 = Justify
7 = Center across cells
9	Number indicating the left-border style assigned to the cell:
0 = No border
1 = Thin line
2 = Medium line
3 = Dashed line
4 = Dotted line
5 = Thick line
6 = Double line
7 = Hairline

10	Number indicating the right-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
11	Number indicating the top-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
12	Number indicating the bottom-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
13	Number from 0 to 18, indicating the pattern of the selected cell as displayed in the Patterns tab of the Format Cells dialog box, which appears when you choose the Cells command from the Format menu. If no pattern is selected, returns 0.
14	If the cell is locked, returns TRUE; otherwise, returns FALSE.
15	If the cell's formula is hidden, returns TRUE; otherwise, returns FALSE.
16	A two-item horizontal array containing the width of the active cell and a logical value indicating whether the cell's width is set to change as the standard width changes (TRUE) or is a custom width (FALSE).
17	Row height of cell, in points.
18	Name of font, as text.
19	Size of font, in points.

20	If all the characters in the cell, or only the first character, are bold, returns TRUE; otherwise, returns FALSE.
21	If all the characters in the cell, or only the first character, are italic, returns TRUE; otherwise, returns FALSE.
22	If all the characters in the cell, or only the first character, are underlined, returns TRUE; otherwise, returns FALSE.
23	If all the characters in the cell, or only the first character, are struck through, returns TRUE; otherwise, returns FALSE.
24	Font color of the first character in the cell, as a number in the range 1 to 56. If font color is automatic, returns 0.
25	If all the characters in the cell, or only the first character, are outlined, returns TRUE; otherwise, returns FALSE. Outline font format is not supported by Microsoft Excel for Windows.
26	If all the characters in the cell, or only the first character, are shadowed, returns TRUE; otherwise, returns FALSE. Shadow font format is not supported by Microsoft Excel for Windows.

27	Number indicating whether a manual page break occurs at the cell:
0 = No break
1 = Row
2 = Column
3 = Both row and column
28	Row level (outline).
29	Column level (outline).
30	If the row containing the active cell is a summary row, returns TRUE; otherwise, returns FALSE.
31	If the column containing the active cell is a summary column, returns TRUE; otherwise, returns FALSE.
32	Name of the workbook and sheet containing the cell If the window contains only a single sheet that has the same name as the workbook without its extension, returns only the name of the book, in the form BOOK1.XLS. Otherwise, returns the name of the sheet in the form "[Book1]Sheet1".
33	If the cell is formatted to wrap, returns TRUE; otherwise, returns FALSE.
34	Left-border color as a number in the range 1 to 56. If color is automatic, returns 0.
35	Right-border color as a number in the range 1 to 56. If color is automatic, returns 0.

36	Top-border color as a number in the range 1 to 56. If color is automatic, returns 0.
37	Bottom-border color as a number in the range 1 to 56. If color is automatic, returns 0.
38	Shade foreground color as a number in the range 1 to 56. If color is automatic, returns 0.
39	Shade background color as a number in the range 1 to 56. If color is automatic, returns 0.
40	Style of the cell, as text.
41	Returns the formula in the active cell without translating it (useful for international macro sheets).
42	The horizontal distance, measured in points, from the left edge of the active window to the left edge of the cell. May be a negative number if the window is scrolled beyond the cell.
43	The vertical distance, measured in points, from the top edge of the active window to the top edge of the cell. May be a negative number if the window is scrolled beyond the cell.

44	The horizontal distance, measured in points, from the left edge of the active window to the right edge of the cell. May be a negative number if the window is scrolled beyond the cell.
45	The vertical distance, measured in points, from the top edge of the active window to the bottom edge of the cell. May be a negative number if the window is scrolled beyond the cell.
46	If the cell contains a text note, returns TRUE; otherwise, returns FALSE.
47	If the cell contains a sound note, returns TRUE; otherwise, returns FALSE.
48	If the cells contains a formula, returns TRUE; if a constant, returns FALSE.
49	If the cell is part of an array, returns TRUE; otherwise, returns FALSE.
50	Number indicating the cell's vertical alignment:
1 = Top 
2 = Center 
3 = Bottom 
4 = Justified
51	Number indicating the cell's vertical orientation:
0 = Horizontal
1 = Vertical
2 = Upward
3 = Downward
52	The cell prefix (or text alignment) character, or empty text ("") if the cell does not contain one.

53	Contents of the cell as it is currently displayed, as text, including any additional numbers or symbols resulting from the cell's formatting.
54	Returns the name of the PivotTable view containing the active cell.
55	Returns the position of a cell within the PivotTableView.
56	Returns the name of the field containing the active cell reference if inside a PivotTable view.
57	Returns TRUE if all the characters in the cell, or only the first character, are  formatted with a superscript font; otherwise, returns FALSE.
58	Returns the font style as text of all the characters in the cell, or only the first character as displayed in the Font tab of the Format Cells dialog box: for example, "Bold Italic".
59	Returns the number for the underline style:
	1 = none
	2 = single
	3 = double
	4 = single accounting
	5 = double accounting
60	Returns TRUE if all the characters in the cell, or only the first characrter, are formatted with a subscript font; otherwise, it returns FALSE.
61	Returns the name of the PivotTable item for the active cell, as text.
62	Returns the name of the workbook and the current sheet in the form "[book1]sheet1".
63	Returns the fill (background) color of the cell.
64	Returns the pattern (foreground) color of the cell.
65	Returns TRUE if the Add Indent alignment option is on (Far East versions of Microsoft Excel only); otherwise, it returns FALSE.
66	Returns the book name of the workbook containing the cell in the form BOOK1.XLS


[Excel 4.0 から変更があったマクロ関数一覧（コマンド対応関数以外)](https://support.microsoft.com/ja-jp/help/402616)
[Excel 4.0 から変更があったマクロ関数一覧（コマンド対応関数）](https://support.microsoft.com/ja-jp/help/402375)
[Excel4.0マクロとは Relief](http://www.relief.jp/docs/001368.html)
[Excel 4.0 マクロを操作する](https://support.office.com/ja-jp/article/Excel-4-0-%E3%83%9E%E3%82%AF%E3%83%AD%E3%82%92%E6%93%8D%E4%BD%9C%E3%81%99%E3%82%8B-ba8924d4-e157-4bb2-8d76-2c07ff02e0b8)
[Working with Excel 4.0 macros Applies To: Excel 2010 ](https://support.office.com/en-us/article/Working-with-Excel-4-0-macros-ba8924d4-e157-4bb2-8d76-2c07ff02e0b8)
[閉じたブックからデータを取得する - Moug.net](https://www.moug.net/tech/exvba/0060037.html)
[「Excel 4.0 マクロ → Visual Basic 対応表」は、何処？ - Windows Script Programming 2007/9/15](http://scripting.cocolog-nifty.com/blog/2007/09/excel_40_visual_a812.html)
どうも、対応表は、Office 95/97 時代の Macrofun.hlp にあるようです。
[Macrofun.exe File Available on Online Services](https://support.microsoft.com/ja-jp/help/128185/macrofun-exe-file-available-on-online-services)
これは前期のMacroFun.hlpとファイル名は同じものがリンクされている。
に追加
[Excel 5.0 にて変更または新規に追加されたマクロ関数一覧](https://support.microsoft.com/ja-jp/help/401694)
[リボンの中で最も利用されないボタン - OfficeTanaka](http://officetanaka.net/excel/excel2007/047.htm)
Excel 2013 でも開発 コントロールにダイアログの実行がある
[セルを参照するボタン-OfficeTanaka](http://officetanaka.net/excel/vba/tips/tips53.htm)
[hlp→chmファイルへの変換に四苦八苦したお話 ](http://teihengrammer.net/chm-hlp)

## GrepReplaceは終了を押しても終了できない
タスクマネージャからしか終了できなかった。（再起動しないからか？）

## このなかでbmpをGifに変えるにはPowershellを使用した
[BMP to JPG the PowerShell way!](https://hazzy.techanarchy.net/posh/powershell/bmp-to-jpg-the-powershell-way/)
[Hey, Scripting Guy! How Can I Use Windows PowerShell to Convert Graphics Files to Different File Formats?](https://blogs.technet.microsoft.com/heyscriptingguy/2010/07/05/hey-scripting-guy-how-can-i-use-windows-powershell-to-convert-graphics-files-to-different-file-formats/)

###BMPtoGIF.ps1

```powershell:BMPtoGIF.ps1
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");
$path ="F:\My Documents\Excel4MacroFun\Macrofun\images"
 $newext = “gif";
 $oldext ="bmp";
 $files=Get-ChildItem $path |where-object {$_.Extension -eq $oldext}

foreach ($file in $files) {
$newimage = new-object System.Drawing.Bitmap($file.FullName);
$newfile = Join-Path -Path $file.directory -ChildPath ($file.BaseName + $newext)
 if(!(Test-Path -Path $newfile))
{
switch($format)
{
“bitmap"{$newimage.Save($newfile,"bmp");}
“emf"{$newimage.Save($newfile,"emf");}
“exif"{$newimage.Save($newfile,"exif");}
“gif"{$newimage.Save($newfile,"gif");}
“icon"{$newimage.Save($newfile,"icon");}
“jpeg"{$newimage.Save($newfile,"jpeg");}
“png"{$newimage.Save($newfile,"png");}
“tiff"{$newimage.Save($newfile,"tiff");}
“wmf"{$newimage.Save($newfile,"wmf");}
}
}
else
{
write-warning “$newfile already exists"
}

$newimage.Dispose()
}
```

#Get.Document

GET.DOCUMENT
###Macro Sheets Only

Returns information about a sheet in a workbook.

###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_numReturns

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_numReturns

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_numReturns

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_numReturns

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.

###Type_numReturns

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.

NoteGET.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_numReturns

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.

###Examples

The following macro formula returns TRUE if the contents of the active document are protected:

GET.DOCUMENT(7)

In Microsoft Excel for Windows, the following macro formula returns the number of windows in SALES.XLS:

GET.DOCUMENT(13, "SALES.XLS")

In Microsoft Excel for the Macintosh, the following macro formula returns 3 if the overlay chart on SALES CHART is a column chart:

GET.DOCUMENT(10, "SALES CHART")

To find out if SHEET1 is password-protected and if its contents and windows are protected, enter the following formula in a three-cell horizontal array:

GET.DOCUMENT({6, 7, 8}, "SHEET1")