2
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.

Visio2016のVBAを使って、Excel2016のシートに値を書き込む

Posted at

VBAを書くのイヤだなーっていいつつ今回も書いていて解決方法がやっと見つかったのでメモ

xlsfromvisio.bas
Dim ExcelSheet as Object

Set ExcelSheet = CreateObject("Excel.Application")
ExcelSheet.Workbooks.Open [読みたいExcelのシート]

' シートに書き込む場合は
' ExcelSheet.ActiveSheet.Cells(row,col).Value = 1
' といった具合にExcelオブジェクトの接頭語が付く
' 今回は  ExcelSheet.
ExcelSheet.ActiveSheet.Cells(row,col).Value = "内容"

ExcelSheet.ActiveWorkbook.Save
ExcelSheet.Application.Quit

Set ExcelSheet = Nothing

今回はActiveSheetへの書き込みができればよかったので試してないですが、任意のシートへアクセスする場合はExcelでシートにアクセスする要領でSheet("名前")みたいにすればいいんじゃないでしょうか。

2
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
2
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?