0
2

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 3 years have passed since last update.

エクセルで、悪さしがちな(他文書などへの)リンク(や名前の定義)をvbaでまとめて消す方法

Posted at

エクセルで、悪さしがちな
(他文書などへの)リンクをvbaでまとめて消す方法

del_link.bas
'すべてのリンクを削除する/ リンクの解除
Sub subete_no_link_wo_sakujo()

    For Each ls In ActiveWorkbook.LinkSources
        'Debug.Print ls
        ActiveWorkbook.BreakLink Name:=ls, Type:=xlExcelLinks
    Next

End Sub

ちなみに、「消すことができない」リンクは、「名前の定義」に含まれていることが多い。このため、名前の定義をまとめて消すコードは以下。
(名前の定義は、手動でもまとめて消せます。念のため。)

del_name.bas
Sub 参考_名前の定義の削除()

    For Each n In ActiveWorkbook.Names
        'Debug.Print n
        n.Delete
    Next

End Sub
0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?