Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Build Error

Build Error

Scheduled Pinned Locked Moved Visual Basic
helpasp-net
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    culbysl
    wrote on last edited by
    #1

    I'm having a strange problem declaring a NEW Excel.Application. I get a blue line under the line xlApp = New Excel.Application(). When I hover over the line the error states "'New' cannot be used on an interface.". I'm a little confused with the interface reference. I have referenced Excel, and MicrosoftOffice.Core and imported them on the page. The problem code is below. Imports Microsoft.Office Imports Excel Imports Microsoft.VisualBasic Imports Microsoft.Win32 Dim xlApp As Excel.Application Dim xlWB1 As Excel.Workbook xlApp = New Excel.Application() <----- Line with Error "'New' cannot be used on an interface." xlApp.Visible = True xlWB1 = xlApp.Workbooks.Open(strPath) xlWB1 = Nothing I am using the same code to open Word docs and PowerPoint presentations. Any suggestions would be very welcome. Thanks in advance

    C 2 Replies Last reply
    0
    • C culbysl

      I'm having a strange problem declaring a NEW Excel.Application. I get a blue line under the line xlApp = New Excel.Application(). When I hover over the line the error states "'New' cannot be used on an interface.". I'm a little confused with the interface reference. I have referenced Excel, and MicrosoftOffice.Core and imported them on the page. The problem code is below. Imports Microsoft.Office Imports Excel Imports Microsoft.VisualBasic Imports Microsoft.Win32 Dim xlApp As Excel.Application Dim xlWB1 As Excel.Workbook xlApp = New Excel.Application() <----- Line with Error "'New' cannot be used on an interface." xlApp.Visible = True xlWB1 = xlApp.Workbooks.Open(strPath) xlWB1 = Nothing I am using the same code to open Word docs and PowerPoint presentations. Any suggestions would be very welcome. Thanks in advance

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Interfaces contain no implementation so there is nothing to create. Are there no examples in the documentation of how to create an Excel application?


      *** Developer Day 4 in Reading, England on 2nd December 2006 - Registration Now Open *** Upcoming Scottish Developers events: * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

      C 1 Reply Last reply
      0
      • C culbysl

        I'm having a strange problem declaring a NEW Excel.Application. I get a blue line under the line xlApp = New Excel.Application(). When I hover over the line the error states "'New' cannot be used on an interface.". I'm a little confused with the interface reference. I have referenced Excel, and MicrosoftOffice.Core and imported them on the page. The problem code is below. Imports Microsoft.Office Imports Excel Imports Microsoft.VisualBasic Imports Microsoft.Win32 Dim xlApp As Excel.Application Dim xlWB1 As Excel.Workbook xlApp = New Excel.Application() <----- Line with Error "'New' cannot be used on an interface." xlApp.Visible = True xlWB1 = xlApp.Workbooks.Open(strPath) xlWB1 = Nothing I am using the same code to open Word docs and PowerPoint presentations. Any suggestions would be very welcome. Thanks in advance

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2005_ta/html/officevstobuildingexcelinvoices.asp[^] It would appear that there is no . (dot) between Excel and Application. You should write New ExcelApplication()


        *** Developer Day 4 in Reading, England on 2nd December 2006 - Registration Now Open *** Upcoming Scottish Developers events: * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

        1 Reply Last reply
        0
        • C Colin Angus Mackay

          Interfaces contain no implementation so there is nothing to create. Are there no examples in the documentation of how to create an Excel application?


          *** Developer Day 4 in Reading, England on 2nd December 2006 - Registration Now Open *** Upcoming Scottish Developers events: * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

          C Offline
          C Offline
          culbysl
          wrote on last edited by
          #4

          Thanks Angus for your thoughts, however your suggestion did not unfortunately work. In the same sub I have created a new word.application with the following syntax: Dim WordApp As Word.Application WordApp = New Word.Application() WordApp.Visible = True WordApp.Documents.Open(strPath) WordApp = Nothing The syntax above works perfectly, opening the word doc. Again thanks for your thoughts and ideas. SL Culbertson

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups