Office ScriptsとVBAマクロは、Excel内での自動化を可能にする点で共通していますが、主な違いがあります。VBAはデスクトップ向けで、ユーザーのデスクトップに完全にアクセスできます。一方、Office Scriptsはクラウドベースで、ワークブックのみアクセス可能です。Office Scriptsは、Power Automateを通じて自動実行でき、組織内のユーザーにより厳格なセキュリティ管理を提供します。VBAはより多くのExcel機能をカバーしますが、Office Scriptsはウェブ版Excelの新機能にも対応しています。
Office ScriptsとVBAマクロの違い
Office ScriptsとVBAマクロは、共通点が多い自動化ツールです。どちらもユーザーが簡単に操作できるアクションレコーダーを通じてソリューションを自動化し、その録音内容を編集することができます。これらのフレームワークは、プログラマーとは考えない人々がExcel内で小さなプログラムを作成する力を与えるように設計されています。
基本的な違い
根本的な違いは、VBAマクロがデスクトップソリューション向けに開発されているのに対し、Office Scriptsは安全でクロスプラットフォーム対応のクラウドベースソリューション向けに設計されている点です。
このアーティクルでは、VBAマクロとOffice Scriptsの主な違いについて説明します。なお、Office ScriptsはExcel専用であるため、ここでの議論はExcelに限られます。
プラットフォームとエコシステム
以下の表は、どのプラットフォームと製品がどの機能をサポートしているかを示しています。
Excel on the web | Excel for Windows | Excel for Mac | Excel for iOS | その他のOffice製品 | Power Automate | |
---|---|---|---|---|---|---|
Office Scripts | はい | はい | はい | いいえ | いいえ | はい |
Office Scriptsアクションレコーダー | はい | はい | はい | いいえ | いいえ | いいえ |
VBAマクロ | いいえ | はい | はい | いいえ | はい | いいえ |
Officeアドイン | はい | はい | はい | はい | はい | いいえ |
COMアドイン | いいえ | はい | いいえ | いいえ | はい | いいえ |
VBAはデスクトップ中心に設計されており、ユーザーのデスクトップと連携することができますが、インターネットにアクセスする便利な方法はありません。一方で、Office ScriptsはJavaScriptのユニバーサルランタイムを使用しており、スクリプトを実行するマシンに関係なく一貫した動作とアクセス性を提供します。また、限られたウェブサービスに呼び出しを行うことも可能です。
ユーザーはOffice Scriptsを使用または作成するために、エンタープライズまたは教育ライセンスが必要です。VBAはデスクトップ版のExcelに内蔵されており、特別なライセンスは必要ありません。
セキュリティ
VBAマクロはExcelと同じセキュリティ権限を持ち、ユーザーのデスクトップに完全なアクセス権を持ちます。一方、Office Scriptsはワークブックにのみアクセスでき、ワークブックをホストするマシンにはアクセスできません。また、JavaScriptの認証トークンをスクリプトと共有することはできません。このため、スクリプトはサインインしたユーザーのトークンを持たず、外部サービスにサインインするためのAPI能力もありません。
管理者はVBAマクロに対して、全てのマクロを許可する、全てのマクロを許可しない、または署名された証明書を持つマクロのみを許可するという3つのオプションがあります。この粒度の低さは、単一の悪意のある行為者を特定するのを難しくします。一方、Office Scriptsは全てのテナントに対してオフにする、全てのテナントに対してオンにする、またはテナント内の一部のユーザーに対してオンにすることが可能です。管理者は誰がスクリプトを他のユーザーと共有できるか、またはPower Automateでスクリプトを使用できるかを制御することもできます。
カバレッジ
現在、VBAは特にデスクトップクライアントで利用可能なExcelの機能をより完全にカバーしています。Office ScriptsはWeb版Excelのほぼ全てのシナリオをカバーしています。新しい機能がWebに登場する際、Office ScriptsはアクションレコーダーとJavaScript APIの両方でそれらをサポートします。
Office ScriptsはExcelレベルのイベントをサポートしていません。スクリプトはユーザーが手動で開始するか、Power Automateのフローがスクリプトを呼び出したときにのみ実行されます。
Power Automate
VBAにはPower Automateコネクタがありません。すべてのサポートされたVBAシナリオは、ユーザーがマクロを実行する必要があります。
Office ScriptsはPower Automateを通じて実行できます。ワークブックは、スケジュールまたはイベント駆動のフローを介して更新され、Excelを開かなくてもワークフローを自動化することができます。Power Automateの使用方法を学ぶには、チュートリアル:Power Automateフローからスプレッドシートを更新を試してみてください。また、自動化されたタスクリマインダーのサンプルを確認して、Office ScriptsがPower Automateを通じてTeamsに接続されている実例を見てみるのも良いでしょう。
————-
Differences between Office Scripts and VBA macros – Office Scripts
Source link
Office Scripts and VBA macros are both tools for automating tasks in Excel, catering to users without extensive programming backgrounds by providing easy-to-use recorders and editable scripts. However, they differ significantly in terms of their design and functionality.
Key Differences:
-
Platform and Ecosystem:
- Office Scripts are designed for cloud-based solutions and can run on various platforms such as Excel on the web, Windows, and Mac (but not iOS). They also integrate with Power Automate for automated workflows.
- VBA macros are primarily desktop-oriented, functioning well in Windows and Mac versions of Excel, but they lack support on the web and mobile platforms.
-
Security:
- VBA macros operate with the same security clearance as Excel, allowing full access to the desktop environment. This can pose security risks, as macros can be run with potentially unsafe privileges.
- In contrast, Office Scripts limit their access to the workbook only, with no ability to access external resources or share user authentication tokens. This enhances security but restricts their functionality.
-
Coverage:
- VBA supports a broader range of Excel features, particularly those available in desktop versions, while Office Scripts cover many features in Excel on the web, with plans to incorporate new functionalities as they launch.
- Integration with Power Automate:
- Office Scripts can be executed through Power Automate, enabling automated workflows without manual effort, whereas VBA does not have this integration and requires user initiation to run macros.
Conclusion:
While both tools aim to simplify task automation in Excel, Office Scripts are more aligned with modern cloud workflows and security protocols, making them suitable for web-based environments. In contrast, VBA macros remain a robust choice for desktop applications but come with security implications that require careful management.