![](/img/trans.png)
[英]Upgrading to Office 2016 Reference Error: Microsoft.Office.Interop.Excel
[英]Adding “Imports Microsoft.Office.Interop.Excel” to my project creates new errors
這里有點新手-退休的VB程序員,所以我是VB.Net的新手。
我一直在開發程序,在測試功能時,我一直在從文件中讀取文本。 我准備下一步從Excel文件而不是文本文件中獲取數據。 因此,我添加了以下行:“導入Microsoft.Office.Interop.Excel”
現在,以前的現有代碼已損壞。 現在該組的最后一行錯誤
"Reference to a non-shared member required an object reference":
Using G = Graphics.FromImage(Bmp)
'Paint the canvas
G.Clear(Color.Black)
G.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBilinear
G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
G.TextRenderingHint = Drawing.Text.TextRenderingHint.SingleBitPerPixel
和
Dim F As New Font(Font_name, Font_Size)
現在給出錯誤“無法在接口上使用'New'”
和
Dim allFonts As New Drawing.Text.InstalledFontCollection
“未定義'Drawing.Text.InstalledFontCollection'的錯誤”
AND ...最神秘的是,如果FontDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel然后,“ Forms”錯誤不是“ Microsoft.Office.Interop.Excel.Windows”的成員
我所做的就是在表單頂部添加“ Imports Microsoft.Office.Interop.Excel”。 在此之前,程序正在運行,沒有錯誤。
任何關於到底發生了什么的指針將不勝感激。 謝謝
您還需要添加對Microsoft.Office.Interop.Excel的引用以及使用Imports語句
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.