Solved

Imports Microsoft.Office.Interop.Excel

Posted on 2011-02-17
3
1,066 Views
Last Modified: 2012-05-11
I Would like to know when I add the following line :

Imports Microsoft.Office.Interop.Excel

All lines where I use drawing functions, for example::
            New Point(contenedor_arbol.Location.X - 15, 55)
            New Rectangle(0, 0, panel_plantilla1.Width - 1, panel_plantilla1.Height - 1)

Shows the following error:
                        'New' cannot be used on an interface

And When I remove:  "Imports Microsoft.Office.Interop.Excel", everything works ok

0
Comment
Question by:altariamx2003
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Den_HBR earned 500 total points
Comment Utility
If you use "Imports Microsoft.Office.Interop.Excel"
VB assumes you are using the interface "Microsoft.Office.Interop.Excel.Point"

If you don't use "Imports Microsoft.Office.Interop.Excel"
VB assumes you are using the structure "System.Drawing.Point"


If you change you code to
 
New System.Drawing.Point(contenedor_arbol.Location.X - 15, 55)
            New System.Drawing.Rectangle(0, 0, panel_plantilla1.Width - 1, panel_plantilla1.Height - 1)

Open in new window

Your code will work
0
 

Author Comment

by:altariamx2003
Comment Utility
ok

thanks bro
0
 

Author Comment

by:altariamx2003
Comment Utility
hehehe

sorry I forget the points

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now