1
0

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 1 year has passed since last update.

【VBA】ブックが開かれたらPowerQueryを起動し、保存して終了させる

Last updated at Posted at 2022-05-25

正しく動かすための準備

  • クエリと接続のプロパティより、「バックグラウンドで更新する」のチェックを外す

これだけ

標準モジュールへ記述。

query.vba
Private Sub Auto_Open()
    If Workbooks.Count > 1 Then
        ThisWorkbook.Close SaveChanges:=True
    Else
        ActiveWorkbook.RefreshAll
        ThisWorkbook.Save
'        MsgBox "保存完了"
        Application.Quit
    End If
End Sub

準備をお忘れなく。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?