ファイルサーバーを SharePoint や OneDrive for Business に移行していくと、ファイルサーバーとの動作の違いによって発生する動作の互換性に悩まされるケースがあります。 Excel のマクロ動作などはよく言われるケースですね。 そこで今回は対応の一例として、 OneDrive for Business 上の Excel ファイルを VBA から開く方法を見ていきたいと思います。 まず重要となるのは、どこに開きたい Excel ファイルがあるかです。 OneDrive for Business では自分のテナント名と UPN の組み合わせでサイトコレクションが決まります。 ここが起点となることを覚えておきます。 この画面のアドレスが以下になるということですね。 https://テナント名-my.sharepoint.com/personal/UPN/ ここにある