Tim,
Thanks for the reply...
The OnConnection event if firing fine. My problem was an inability to get
to any Workbook or Worksheet. I was using CType to get the appobject to
become type Excel.Application. I thought that would be fine. When my first
approach didn't work trying to get to a specific workbook by ordinal, I set a
breakpoint and tried to do everything from the Command window - this approach
is great for trying out one-liners. In every case, I'd get a COMInterop
failure.
Honestly, I don't know what I did to fix it... but ultimately, I was able to
get some results by Dim'ing the hell out of everything...
To wit:
Dim wb as Excel.Workbook = applicationObject.Workbooks(1)
Dim ws as Excel.Worksheet = wb.Worksheets("Test") ' or Worksheets(1)
CType(ws.Cells(1, 1), Excel.Range).Value="Boy is this cumbersome"
Nevertheless, I SWEAR to you that the first two statements above didn't work
initially. I guess waving the dead chicken over the keyboard did the trick.
Thanks for taking the time...
M.
"Tim Williams" wrote:
So when your addin is loaded does the OnConnection event fire? From
Tom's reference that should give you a handle to the "host application
object": from this you should be able to get a reference to workbooks
etc. Are you not getting this object passed?
Do you have any code you can show ?
Tim.
"Michael Conroy" wrote in
message ...
Hi folks...
All I want to do is create a COM VB.NET addin for Excel. I used
the
Wizard. I can create a spiffy CommandBar with buttons and
everything. What
I CAN'T do is reference the silly applicationObject. No matter WHAT
I do...
Cells, Range, etc... I can't even get an ActiveWorkbook returned.
Can
anyone point me to a stupid simple example showing how to write a
value to a
cell using VB.NET as an Addin? Plenty of samples show how to invoke
Excel
from an app, but I want my app to live inside Excel as an addin.
Thanks,
M.