【发布时间】:2014-04-19 02:44:25
【问题描述】:
设置环境:
我正在使用 vb.net 开发 Excel 2010 应用程序级插件。
我的目标:
- 将项目资源(即 Excel 工作表)临时保存到用户的 电脑
- 使用 vb.net 以编程方式查询电子表格
- 完成后删除文件
此代码用于临时保存然后删除 .png 文件:
'Create temporary file path using the commonapplicationdata folder
Dim picturepath As StringBuilder
picturepath = New StringBuilder(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData))
picturepath.Append("\chartGridlines.png")
'Save resources into temp location in HD
My.Resources.grayGrid.Save(picturepath.ToString, System.Drawing.Imaging.ImageFormat.Png)
'Add picture to the worksheet
With Globals.ThisAddIn.Application.Selection.ShapeRange.Fill
.UserPicture(picturepath.ToString())
End With
'Clean up and delete the png from commonapplicationdata folder
System.IO.File.Delete(picturepath.ToString())
如何对 .xlsm 文件做同样的事情?
有人能指点我如何去做这件事吗?我真的很感激。
【问题讨论】:
标签: .net vb.net excel visual-studio-2010 vsto