Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Add in blows up! Author disavows responsibility

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add in blows up! Author disavows responsibility

http://support.microsoft.com/default.aspx?kbid=302896
How To Build an Office COM Add-in by Using Visual Basic .NET

--
Regards,
Tom Ogilvy



"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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Add in blows up! Author disavows responsibility

Tom,

Thanks for the post. Sadly - I've been there. In fact, that's where I
started to build my little add-in framework. What the article *doesn't*
address (hence the origin of the question), is how to tickle a cell in Excel.
It really shouldn't be difficult from within the add-in - in fact, I would
think it'd be a snap. However, as my first post alluded, it just ain't
happenin'.

Cheers,
M.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Add in blows up! Author disavows responsibility

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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Add in blows up! Author disavows responsibility

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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Add in blows up! Author disavows responsibility

.....I always keep a chicken handy for just that purpose

Tim.


"Michael Conroy" wrote in
message ...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comments Author LSC Excel Discussion (Misc queries) 1 May 8th 09 05:41 PM
VLOOKUP blows up file size BlueTill Excel Worksheet Functions 0 July 14th 05 01:54 PM
Excel blows up when selecting a formula CJS Excel Discussion (Misc queries) 1 June 14th 05 09:27 PM
Saving Excel document blows up Infragistics menu in frame Amy B[_2_] Excel Programming 0 October 12th 04 05:16 PM
Excel 2003 blows me right out sometimes EnigmaCDE[_2_] Excel Programming 1 August 19th 04 12:02 AM


All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"