2 Replies - 2856 Views - Last Post: 26 October 2009 - 10:01 AM Rate Topic: -----

#1 Mahey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 22-April 09

Weird Probelm- Excel Automation - Insert Picture()

Posted 26 October 2009 - 06:20 AM

Actually Iam using Office 2007. So I added the reference, Microsoft.Office.Interop.Excel 12.0 to my project.

Iam using vb.net 2008.When I try to insert a picture in Excel. I get a error "Reference require to Assembly 'Office....,
version 11.0.0.0....Microsoft.Office.Core.MsoTriState add one to your project...

I cannot find this reference. Where to find?

Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Add(misValue)
xlWorkSheet = xlWorkBook.Sheets("sheet1")
xlWorkSheet.Cells(1, 1) = "CODEPROJECT"
xlWorkSheet.Cells(2, 1) = "Adding picture in Excel File"

'PROBLEM IN BELOW LINE 

xlWorkSheet.Shapes.AddPicture("C:\xl_pic.JPG", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 45)


xlWorkSheet.SaveAs("C:\vb_net\vbexcel.xlsx")
xlWorkBook.Close()
xlApp.Quit()



Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Weird Probelm- Excel Automation - Insert Picture()

#2 snikmotnairb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 70
  • Joined: 02-May 08

Re: Weird Probelm- Excel Automation - Insert Picture()

Posted 26 October 2009 - 07:23 AM

It's asking for the Primary Interop Assemblies from Office 2003.

This link might help:

MSDN - Office 2003 Primary Interop Assemblies
Was This Post Helpful? 0
  • +
  • -

#3 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 357
  • View blog
  • Posts: 2,768
  • Joined: 18-September 06

Re: Weird Probelm- Excel Automation - Insert Picture()

Posted 26 October 2009 - 10:01 AM

It's not asking for the Office 2003 PIAs, it is trying to find something from the Office Core PIA.

Try adding another reference. You are looking for something along the lines of:

Microsoft.Office.Interop.Core

At least I think I'm right here. It's been a while since I last looked at something like this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1