0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel VBA テストプリントの時だけヘッダーに印刷日時を入れて、そのあとヘッダーを削るマクロ

Last updated at Posted at 2020-03-24

前提

'WorkBookはすでに保存してある

動作内容

  1. いったん保存したファイルを(閉じるまでは不要)左上のヘッダーに現在の日付時刻、ファイル名を入れて印刷する
  2. 一度印刷していて、縮小率、列タイトルなどはあらかじめ設定したある事
  3. 印刷したらすべてのヘッダー、フッターの削除をかけて、保存する
# ポイント ## マクロの記録ではプリントプレビューが記録されるため、削除すること マクロでプリントプレビューを表示させても、記録させたマクロに Sheets.PrintPreview が記録され、そこで手動になる。このため、それを消さなければならない。 ## 設定してある書式は消える時があるため、何度も登録する 縮小がかかっているなどのほかに設定してある書式は全部繰り返した方が安全。 ## 最大のポイントはヘッダーが削除できないこと ### 参考にしたサイト https://www.mrexcel.com/board/threads/vba-code-to-remove-headers-and-footers.754356/ ### Printerとの通信をした状態で、いったん範囲消去をして、もう一度設定する。 ページの書式をクリアしているらしい。 また、FalseからTrueにしたとき、どうも設定をすべて読み込まない。 このため、処理が遅くなろうとSleepを入れて読ませた方がよいらしい。 効かないときはSleepTimeを延長する ## コメントの定数 Name Value Description xlPrintInPlace 16 Comments will be printed where they were inserted on the worksheet. xlPrintNoComments -4142 Comments will not be printed. xlPrintSheetEnd 1 Comments will be printed as end notes at the end of the worksheet.

Application communication プロパティ (Excel)
プリンターとの通信が有効かどうかを指定します。 読み取り/書き込みが可能な Boolean です。
PageSetup プロパティを設定するコードの実行速度を速くするには、 printcommunicationプロパティをFalseに設定します。
となっているが、ヘッダーやフッターの削除は通信したままでSleepをかけて段階的に入れた方が効くらしい。

'Sleep Unit
# If VBA7 Then
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
# Else
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
# End If

以上を上に置いておく。
そして書式を決めてあるxlsxファイルにデータを流し込み、保存する
という状態のあとでこういう記述になる

Application.PrintCommunication = False
With ActiveSheet.PageSetup 'まずWorkbookは保存してあるのが前提。ActivateでActiveSheetに持ち込む
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$C$30" '絶対番地
Application.PrintCommunication = False
With ActiveSheet.PageSetup
If .LeftHeader = "" Then .LeftHeader = "&D" & "&T" & "&F": Sleep 500 ’成功率が低いので一つにまとめている
.PrintComments = xlPrintNoComments 'シートのコメントは印刷しない[PrintComments](https://docs.microsoft.com/ja-jp/office/vba/api/excel.pagesetup.printcomments) [XlPrintLocation](https://docs.microsoft.com/ja-jp/office/vba/api/excel.xlprintlocation)
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait '縦長
.Zoom = 94 ’ちょっと縮小。これはこういう場合もあるというだけで、なんでも94パーセントとかそういう意味ではありません。
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = False
End With
’ここで印刷
Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintOut copies:=1, collate:=True, _
IgnorePrintAreas:=False
With CreateObject("Scripting.FileSystemObject") 'TestPrintのためのPDF出力
activeworkbook.ExportAsFixedFormat XlFixedFormatType.xlTypePDF, .GetParentFolderName(activeworkbook.FullName) & .GetBaseName(activeworkbook.FullName) & ".pdf", XlFixedFormatQuality.xlQualityStandard, , , 1, 1, False
End With
'ここがポイント、いったんTrueにしてプリンターの通信をかけて
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "": DoEvents: Sleep 500
.CenterHeader = "": DoEvents: Sleep 500
.RightHeader = "": DoEvents: Sleep 500
.LeftFooter = "": DoEvents: Sleep 500
.CenterFooter = "": DoEvents: Sleep 500
.RightFooter = "": DoEvents: Sleep 500
If .LeftHeader <> "" Then .LeftHeader = WorksheetFunction.Substitute(.LeftHeader, "&D" & "&T" & "&F", ""): DoEvents: Sleep 500
If .CenterHeader <> "" Then .CenterHeader = WorksheetFunction.Substitute(.CenterHeader, "&T", ""): DoEvents: Sleep 500
If .LeftFooter <> "" Then .LeftFooter = WorksheetFunction.Substitute(.LeftFooter, "&F", ""): DoEvents: Sleep 500
.LeftHeader = "": DoEvents: Sleep 500
.CenterHeader = "": DoEvents: Sleep 500
.LeftFooter = "": DoEvents: Sleep 500
.Zoom = 94
End With
With Application
.PrintCommunication = False
.PageSetup.PrintArea = "$A$1:$C$30"
.DisplayAlerts = False
.ScreenUpdating = False
End With
With ActiveSheet.PageSetup
' 設定していない分も丁寧に削り込む
.LeftHeader = "": DoEvents: Sleep 500
.CenterHeader = "": DoEvents: Sleep 500
.RightHeader = "": DoEvents: Sleep 500
.LeftFooter = "": DoEvents: Sleep 500
.CenterFooter = "": DoEvents: Sleep 500
.RightFooter = "": DoEvents: Sleep 500
If .LeftHeader <> "" Then .LeftHeader = WorksheetFunction.Substitute(.LeftHeader, "&D" & "&T" & "&F", ""): DoEvents: Sleep 500
.LeftHeader = "": DoEvents: Sleep 500
.CenterHeader = "": DoEvents: Sleep 500
.LeftFooter = "": DoEvents: Sleep 500
.Zoom = 94
End With
Application.PrintCommunication = True
Activeworkbook.Save ’保存して削除確定
Application.DisplayAlerts = True
Application.ScreenUpdating = True

これでEnd Sub
あとは保存したファイルを添付して送ってもよい。
保存したファイルに印刷した日時が書きこまれて残るが、ファイルには残らない。
ただ、この処理は非常に不安定だ。
Excel でワークシートのヘッダーやフッターを一括で置換する。
これを応用してクリアをしかけたが、あまりできないらしい。ただ、有効な場合を考えて入れてある。
不思議なのはPrinterに送信をする命令というのはないらしい。

『printcommunication=trueで実行時エラー1004の対処方法』(gencyan)

PrintCommunication切らなければエラーは発生しないんですよね。
肝心のPageSetupの部分は何も変えてないのに。

私の場合、
このマクロがサクッと走る様にする目的でPrintCommunication切っただけだったので、
PrintCommunication切るのは止めました。

余談ですが、
自分のPCで作成したファイルを別PCで開くと
印刷とは全く関係のないマクロが何故か正常に動かなかったことがあって、
それがその別PCだけで発生する症状で、他のPCだと問題ない。

原因が分からず諦めかけてたところに、
たまたまその別PCのプリンタドライバを入れ替えることになり、
それを境に症状が直った。

なんて事もありました。

なので、
印刷に直接関係しない場面でもExcelさんはプリンタドライバから
いろいろ影響を受けているんだろな・・・
と思って、
何となくPrintCommunicationは切らない様にしています。

(白茶) 2018/02/09(金) 18:00

Excel 2010でページ設定(PageSetup)の動作を高速化する
上記結果を見ると確かにPrintCommunicationプロパティを設定した方が早く処理が終わっています。

下記Microsoftのページを見ると、Excel 4.0 マクロから新たに追加された機能への移行が推奨されているようです。
「Excel 4.0 マクロを操作する」
http://office.microsoft.com/ja-jp/excel-help/HA010336614.aspx
「Migrating Excel 4 Macros to VBA」
http://blogs.office.com/b/microsoft-excel/archive/2010/02/16/migrating-excel-4-macros-to-vba.aspx

ExcelVBA PageSetup高速化 PrintComminucateion の 1004エラー対処 - 12/22/2014 全部楽しもう

ただし、Excel4Macroは少々クセがあり、指定パラメータによっては無視されるパラメータがあったります。
筆者もかなりいじめられました。
Excel2010よりPrintCommunicationプロパティーが追加(プリンタとの通信フラグ)されExcel4Macroよりこちらの高速化が推奨されているのは知っていたのですが、どうもこちらもクセがあるので少々敬遠していたのですが、今回色々調べてみたのでメモを記載しておきます。
PrintCommunicationプロパティーはFalseを設定するとPageSetupへの設定がすべてキャッシュされ、Trueを設定すると一気に設定がコミットされます。
一つにまとめることで、オーバーヘッドが激減するでしょうから、かなりの高速化が見込めるのはわかります。
しかし、クセがあるのです。以下のコードは最終行で1004エラーが発生しま
Fit to pageの指定はzoomの後

Excel4Cacor PAGE.SETUP

Macro Sheets Only
Equivalent to choosing the Page Setup command from the File menu. Use PAGE.SETUP to control the printed appearance of your sheets.
There are three syntax forms of PAGE.SETUP. Syntax 1 applies if a sheet or macro sheet is active; syntax 2 applies if a chart is active; syntax three applies to Visual Basic modules and the info Window.
Arguments correspond to check boxes and text boxes in the Page Setup dialog box. Arguments that correspond to check boxes are logical values. If an argument is TRUE, Microsoft Excel selects the check box; if FALSE, Microsoft Excel clears the check box. Arguments for margins are always in inches, regardless of your country setting.

[ファイル]メニューから[ページ設定]コマンドを選択するのと同じです。 PAGE.SETUPを使用して、シートの印刷された外観を制御します。
PAGE.SETUPには3つの構文形式があります。 構文1は、シートまたはマクロシートがアクティブな場合に適用されます。 構文2は、グラフがアクティブな場合に適用されます。 構文3は、Visual Basicモジュールと情報ウィンドウに適用されます。
引数は、[ページ設定]ダイアログボックスのチェックボックスとテキストボックスに対応しています。 チェックボックスに対応する引数は論理値です。 引数がTRUEの場合、Microsoft Excelはチェックボックスをオンにします。 FALSEの場合、Microsoft Excelはチェックボックスをオフにします。 国の設定に関係なく、マージンの引数は常にインチ単位です。

Syntax 1

Worksheets and macro sheets
PAGE.SETUP(head, foot, left, right, top, bot, hdng, grid, h_cntr, v_cntr, orient, paper_size, scale, pg_num, pg_order, bw_cells, quality, head_margin, foot_margin, notes, draft)
PAGE.SETUP?(head, foot, left, right, top, bot, hdng, grid, h_cntr, v_cntr, orient, paper_size, scale, pg_num, pg_order, bw_cells, quality, head_margin, foot_margin, notes, draft)

Syntax 2

Charts
PAGE.SETUP(head, foot, left, right, top, bot, size, h_cntr, v_cntr, orient, paper_size, scale, pg_num, bw_chart, quality, head_margin, foot_margin, draft)
PAGE.SETUP?(head, foot, left, right, top, bot, size, h_cntr, v_cntr, orient, paper_size, scale, pg_num, bw_chart, quality, head_margin, foot_margin, draft)

Syntax 3

Visual Basic Modules and the Info Window
PAGE.SETUP(head, foot, left, right, top, bot, orient, paper_size, scale, quality, head_margin, foot_margin, pg_num)
PAGE.SETUP?(head, foot, left, right, top, bot, orient, paper_size, scale, quality, head_margin, foot_margin, pg_num)
Head specifies the text and formatting codes for the header for the current sheet . For information about formatting codes, see "Remarks" later in this topic.
Foot specifies the text and formatting codes for the workbook footer.
Left corresponds to the Left box and is a number specifying the left margin.
Right corresponds to the Right box and is a number specifying the right margin.
Top corresponds to the Top box and is a number specifying the top margin.

Bot corresponds to the Bottom box and is a number specifying the bottom margin.
Hdng corresponds to the Row & Column Headings check box. Hdng is available only in the sheet and macro sheet form of the function.
Grid corresponds to the Cell Gridlines check box. Grid is available only in the sheet and macro sheet form of the function.
H_cntr corresponds to the Center Horizontally check box in the Margins panel of the Page Setup dialog box.
V_cntr corresponds to the Center Vertically check box in the Margins panel of the Page Setup dialog box.
Orient determines the direction in which your workbook is printed.

Orient Print format
1 Portrait
2 Landscape

Paper_size is a number from 1 to 26 that specifies the size of the paper.

Paper_size Paper type
1 Letter
2 Letter (small)
3 Tabloid
4 Ledger
5 Legal
6 Statement
7 Executive
8 A3
9 A4
10 A4 (small)
11 A5
12 B4
13 B5
14 Folio
15 Quarto
16 10x14
17 11x17
18 Note
19 ENV9
20 ENV10
21 ENV11
22 ENV12
23 ENV14
24 C Sheet
25 D Sheet
26 E Sheet

Scale is a number representing the percentage to increase or decrease the size of the sheet. All scaling retains the aspect ratio of the original.

To specify a percentage of reduction or enlargement, set scale to the percentage.
For worksheets and macros, you can specify the number of pages that the printout should be scaled to fit. Set scale to a two-item horizontal array, with the first item equal to the width and the second item equal to the height. If no constraint is necessary in one direction, you can set the corresponding value to #N/A.
Scale can also be a logical value. To fit the print area on a single page, set scale to TRUE.

縮小または拡大の割合を指定するには、スケールを割合に設定します。
ワークシートとマクロの場合、印刷物が収まるように拡大縮小する必要があるページ数を指定できます。 スケールを2アイテムの水平配列に設定します。最初のアイテムは幅に等しく、2番目のアイテムは高さに等しくなります。 一方向に制約が必要ない場合は、対応する値を#N / Aに設定できます。
スケールは論理値にすることもできます。 印刷領域を1ページに収めるには、スケールをTRUEに設定します。

Pg_num specifies the number of the first page. If zero, sets first page to zero. If "Auto" is used, then the page numbering is set to automatic. If omitted, PAGE.SETUP retains the existing pg_num.
Pg_order specifies whether pagination is left-to-right and then down, or top-to-bottom and then right.

Pg_order Pagination
1 Top-to-bottom, then right
2 Left-to-right, then down

Bw_cells is a logical value that specifies whether to print cells and all graphic objects, such as text boxes and buttons, in color.

If bw_cells is TRUE, Microsoft Excel prints cell text and borders in black and cell backgrounds in white.
If bw_cells is FALSE , Microsoft Excel prints cell text, borders, and background patterns in color (or in gray scale).

Bw_chart is a logical value that specifies whether to print chart in color.
Size is a number corresponding to the options in the Chart Size box, and determines how you want the chart printed on the page within the margins. Size is available only in the chart form of the function.

Size Size to print the chart

1 Screen size
2 Fit to page
3 Full page

Quality specifies the print quality in dots-per-inch. To specify both horizontal and vertical print quality, use an array of two values.
Head_margin is the placement, in inches, of the running head margin from the edge of the page.
Foot_margin is the placement, in inches, of the running foot margin from the edge of the page.
Draft corresponds to the Draft Quality checkbox in the Sheet tab and in the Chart tab of the Page Setup dialog box. If FALSE or omitted, graphics are printed with the sheet. If TRUE, no graphics are printed.
Notes specifies whether to print cell notes with the sheet. If TRUE, both the sheet and the cell notes are printed. If FALSE or omitted, just the sheet is printed.

Remarks

Microsoft Excel no longer requires you to enter formatting codes to format headers and footers, but the codes are still supported and recorded by the macro recorder. You can include these codes as part of the head and foot text strings to align portions of the header or footer to the left, right, or center; to include the page number, date, time, or workbook name; and to print the header or footer in bold or italic.
Microsoft Excelでは、ヘッダーとフッターをフォーマットするためにフォーマットコードを入力する必要がなくなりましたが、コードは引き続きマクロレコーダーでサポートおよび記録されます。 これらのコードをヘッダーおよびフッターのテキスト文字列の一部として含めて、ヘッダーまたはフッターの一部を左、右、または中央に揃えることができます。 ページ番号、日付、時刻、またはワークブック名を含めるため。 ヘッダーまたはフッターを太字または斜体で印刷します。

Formatting code Result

&L Left-aligns the characters that follow.
&C Centers the characters that follow.
&R Right-aligns the characters that follow.
&B Turns bold printing on or off (now obsolete).
&I Turns italic printing on or off.
&U Turns single underlining printing on or off.
&S Turns strikethrough printing on or off.
&O Turns outline printing on or off (Macintosh only).
&H Turns shadow printing on or off (Macintosh only).
&D Prints the current date.
&T Prints the current time.
&A Prints the name of the sheet
&F Prints the name of the workbook.
&P Prints the page number.
&P+number Prints the page number plus number.
&P-number Prints the page number minus number.
&& Prints a single ampersand.

& "fontname, fontstyle" Prints the characters that follow in the specified font and style. Be sure to include a comma immediately following the fontname, and double quotation marks around fontname and fontstyle.
&nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points.
&N Prints the total number of pages in the workbook.
&E Prints a double underline
&X Prints the character as superscript
&Y Prints the chararcter as subscript

Related Functions

DISPLAY Controls screen and Info Window display
GET.DOCUMENT Returns information about a workbook
PRINT Prints the active workbook
WORKSPACE Changes workspace settings

List of Command-Equivalent Functions

Migrating Excel 4 Macros to VBA

Diego Oppenheimer
16 Feb 2010 4:00 PM
Thanks to Eric Patterson for writing this blog post.

As promised in our Programmability Improvements in Excel 2010, here are more details about the Excel 2010 improvements to aid in migrating Excel 4 Macros to VBA.

Excel has a macro facility, known as Excel 4 macros (XLM for short) that was the primary macro language prior to the introduction of VBA in Excel 5.0. Most people have long since migrated their Excel 4 macros to VBA; however, some Excel 4 macro capabilities were missing from VBA, which made this migration difficult.

In Excel 2010, one of our goals was to remove any remaining barriers that people had to complete the migration of Excel 4 macros to VBA. Excel 2010 does still enable the creation, editing and execution of Excel 4 macros. Please use Excel 2010 to migrate your macros and let us know if we missed any functionality.
Excelには、Excel 5.0にVBAが導入される前の主要なマクロ言語であったExcel 4マクロ(略してXLM)と呼ばれるマクロ機能があります。ほとんどの人は、Excel 4マクロをVBAに移行してからずっと経ちました。ただし、VBAには一部のExcel 4マクロ機能が欠けていたため、この移行は困難でした。

Excel 2010での目標の1つは、Excel 4マクロのVBAへの移行を完了するために必要な障壁を取り除くことでした。 Excel 2010では、Excel 4マクロの作成、編集、実行は引き続き可能です。 Excel 2010を使用してマクロを移行し、機能が不足している場合はお知らせください。

Print Performance

The PAGE.SETUP() XLM function allows multiple Page Setup properties to be set with one call resulting in better performance than setting multiple PageSetup properties via VBA. In Excel 2010, we have added a new PrintCommunication property that suspends printer communication to improve performance. You can set the property to False in your code prior to using page setup methods and then set it to True afterwards to execute all of the built up commands. If there are cached commands, setting the property to True will commit all cached PageSetup commands. This should eliminate any need for the legacy PAGE.SETUP() function.
Excel 2010のプログラマビリティの向上でお約束したように、Excel 4マクロをVBAに移行する際に役立つExcel 2010の改善点について詳しく説明します。

印刷性能

PAGE.SETUP()XLM関数を使用すると、1回の呼び出しで複数のページ設定プロパティを設定でき、VBAを介して複数のPageSetupプロパティを設定するよりもパフォーマンスが向上します。 Excel 2010では、パフォーマンスを改善するためにプリンター通信を一時停止する新しいPrintCommunicationプロパティを追加しました。ページセットアップメソッドを使用する前に、コードでプロパティをFalseに設定し、その後でTrueに設定して、構築されたすべてのコマンドを実行できます。キャッシュされたコマンドがある場合、プロパティをTrueに設定すると、キャッシュされたすべてのPageSetupコマンドがコミットされます。これにより、従来のPAGE.SETUP()関数が不要になります。
For example, If you want to set your page margins, orientation, paper size, and scale to fit one page, you set the following 8 properties using VBA. Each one will need to establish communications with the printer driver and pass along the setting.

たとえば、ページの余白、向き、用紙サイズ、およびスケールを1ページに合わせて設定する場合は、VBAを使用して次の8つのプロパティを設定します。 それぞれがプリンタドライバとの通信を確立し、設定を渡す必要があります。

With ActiveSheet.PageSetup
 .LeftMargin = Application.InchesToPoints(0.25)
 .RightMargin = Application.InchesToPoints(0.25)
 .TopMargin = Application.InchesToPoints(0.75)
 .BottomMargin = Application.InchesToPoints(0.75)
 .Orientation = xlLandscape
 .PaperSize = xlPaperLetter
 .FitToPagesWide = 1
 .FitToPagesTall = 1
End With

With the new PrintCommunications property you can add one statement before the PageSetup statements and one after and reduce the calls to the printer from 8 to 1 for this simple example.

新しいPrintCommunicationsプロパティを使用すると、PageSetupステートメントの前と後に1つのステートメントを追加し、この単純な例でプリンターへの呼び出しを8から1に減らすことができます。

' Excel 2010 And Later (ver.14 later)
Application.PrintCommunication = False
With ActiveSheet.PageSetup
 .LeftMargin = Application.InchesToPoints(0.25)
 .RightMargin = Application.InchesToPoints(0.25)
 .TopMargin = Application.InchesToPoints(0.75)
 .BottomMargin = Application.InchesToPoints(0.75)
 .Orientation = xlLandscape
 .PaperSize = xlPaperLetter
 .FitToPagesWide = 1
 .FitToPagesTall = 1
End With
Application.PrintCommunication = True

Charting Enhancements

There are a number of properties for chart elements that were previously only accessible through the Excel 4 Macro Language. We have added additional properties to VBA for these items.

グラフの強化

以前はExcel 4マクロ言語を介してしかアクセスできなかったグラフ要素のプロパティがいくつかあります。 これらのアイテムのVBAに追加のプロパティを追加しました。

Formula Properties

New properties replace the GET.FORMULA() XLM command, providing formula support for missing chart elements. New Formula properties (Formula, FormulaR1C1, FormulaLocal, FormulaR1C1Local) have been added for AxisTitle, ChartTitle, DisplayUnitLabel, and DataLabel objects.

GET.FORMULA()XLMコマンドに代わる新しいプロパティがあり、不足しているグラフ要素の数式をサポートします。 AxisTitle、ChartTitle、DisplayUnitLabel、DataLabelオブジェクトに、新しいFormulaプロパティ(Formula、FormulaR1C1、FormulaLocal、FormulaR1C1Local)が追加されました。

Series/Point Name

The chart object model currently doesn’t provide a way to determine the series name that is given to a series when it is created. This information is available when hovering over a data point with the mouse, or using the SELECTION() function in XLM. The XLM command returns a point name in the format “SmPn” where m is the series number assigned when the chart is created and n is the point number. For example, when selecting a point on a chart, SELECTION() returns "S1P3". A new Point.Name property has been added that Returns a point name in the format “SmPn” where m is the series number assigned when the chart is created and n is the point number.
現在、グラフオブジェクトモデルは、シリーズの作成時にシリーズに付けられるシリーズ名を決定する方法を提供していません。 この情報は、マウスでデータポイントにカーソルを合わせたとき、またはXLMでSELECTION()関数を使用したときに利用できます。 XLMコマンドは、「SmPn」の形式でポイント名を返します。ここで、mはチャートの作成時に割り当てられたシリーズ番号、nはポイント番号です。 たとえば、チャート上のポイントを選択すると、SELECTION()は「S1P3」を返します。 新しいPoint.Nameプロパティが追加されました。「SmPn」の形式でポイント名を返します。ここで、mはグラフの作成時に割り当てられた系列番号、nはポイント番号です。

Position Properties

The XLM Function GET.CHART.ITEM returns the X,Y coordinates of the corners or mid-points of any chart item. This function had been necessary for some chart elements that did not have positional (.Left, .Top, .Width, and .Height) properties. In Excel 2010 we added .Left, .Top, .Width, and .Height properties for any chart elements that did not have them. This included AxisTitle, ChartTitle, DisplayUnitLabel, Point, and DataLabel objects. Additionally we added a Point.PieSliceLocation Method that returns coordinates of multiple points on Pie Slices.

XLM関数GET.CHART.ITEMは、グラフアイテムの角または中点のX、Y座標を返します。 この関数は、位置(.Left、.Top、.Width、および.Height)プロパティを持たない一部のグラフ要素に必要でした。 Excel 2010では、.Left、.Top、.Width、および.Heightプロパティを、それらを持たないグラフ要素に追加しました。 これには、AxisTitle、ChartTitle、DisplayUnitLabel、Point、およびDataLabelオブジェクトが含まれていました。 さらに、パイスライス上の複数のポイントの座標を返すPoint.PieSliceLocationメソッドを追加しました。

General Improvement

In addition to the charting enhancements, there are a few additional XLM functions that needed equivalent VBA fucntions.
一般的な改善

グラフの機能強化に加えて、同等のVBA機能を必要とするいくつかの追加のXLM関数があります。

Addins2 Collection Object

Excel currently has an AddIns Collection that represents the list of add-ins that is displayed in the Add-Ins dialog box in Excel. What this collection is missing and can be determined by the DOCUMENTS(2) XLM function are any add-ins that are currently open (and not shown in the dialog). A new AddIns2 collection object has been added that represents all the add-ins currently available or open in Microsoft Excel, regardless of whether they’re installed.

Excelには現在、Excelの[アドイン]ダイアログボックスに表示されるアドインのリストを表すAddInsコレクションがあります。 このコレクションに不足していて、DOCUMENTS(2)XLM関数で判別できるのは、現在開いている(ダイアログには表示されない)アドインです。 インストールされているかどうかに関係なく、現在利用可能な、またはMicrosoft Excelで開いているすべてのアドインを表す新しいAddIns2コレクションオブジェクトが追加されました。

AddIn.IsOpen Property

A new IsOpen Property has been added that returns True if the AddIn is currently open
AddInが現在開いている場合にTrueを返す新しいIsOpenプロパティが追加されました
Printed Comment Pages

Excel has the facility to print any cell comments on separate pages from the printed worksheet. The Excel 4 macro language has a function (Get.Document(51)) that returns the number of comments pages that will be printed. A new PrintedCommentPagesCount Property has been added to Excel 2010 to provide this functionality.
Excelには、印刷されたワークシートとは別のページにセルのコメントを印刷する機能があります。 Excel 4マクロ言語には、印刷されるコメントページの数を返す関数(Get.Document(51))があります。 この機能を提供するために、新たにPrintedCommentPagesCountプロパティがExcel 2010に追加されました。

Argument Descriptions for User Defined Functions

The only way to get argument descriptions for custom worksheet functions into the Function Wizard is using XLM Macro Options dialog box. In Excel 2010, we added a new argument to the MacroOptions VBA Meth

カスタムワークシート関数の引数の説明を関数ウィザードに取り込む唯一の方法は、[XLMマクロオプション]ダイアログボックスを使用することです。 Excel 2010では、MacroOptions VBA Methに新しい引数を追加しました

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?