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. Calling an excel function

Calling an excel function

Scheduled Pinned Locked Moved Visual Basic
comhelpcsharpquestion
2 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.
  • M Offline
    M Offline
    Mark06
    wrote on last edited by
    #1

    Hi, I have an addin module plugged into Excel, which exposes some functions to do stuff. Im need to call those function through some VB.Net code, but its failing without much help. Its a generic ole error returned, nothing useful at all. If the workbook contains a function/macro, I can call that easy using the Excel.ExecuteExcel4Macro() line. But this doesnt seem to work for addins. My code looks like this: Dim ex As New Microsoft.Office.Interop.Excel.Application() ... Do stuff ... ex.ExecuteExcel4Macro("RUN(""ConvertData"")") ex.Visible = True The VB.Net program opens Excel as a COM object, post some data to it, then needs to call the functions in the addin. Anyone know of the correct syntax, or can spot where Ive gone wrong? Mark

    O 1 Reply Last reply
    0
    • M Mark06

      Hi, I have an addin module plugged into Excel, which exposes some functions to do stuff. Im need to call those function through some VB.Net code, but its failing without much help. Its a generic ole error returned, nothing useful at all. If the workbook contains a function/macro, I can call that easy using the Excel.ExecuteExcel4Macro() line. But this doesnt seem to work for addins. My code looks like this: Dim ex As New Microsoft.Office.Interop.Excel.Application() ... Do stuff ... ex.ExecuteExcel4Macro("RUN(""ConvertData"")") ex.Visible = True The VB.Net program opens Excel as a COM object, post some data to it, then needs to call the functions in the addin. Anyone know of the correct syntax, or can spot where Ive gone wrong? Mark

      O Offline
      O Offline
      OldWarhorse
      wrote on last edited by
      #2

      Mark, Try this: http://support.microsoft.com/kb/198571[^] The article is for Access 2000, but the code would be very similar. (Without the Set statements of course.)

      objExcel.Application.Run("atpvbaen.xla!lcm", 5, 2)

      Dave

      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