Thread: Excel Com Addin
View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Excel Com Addin

Yes, I know what you were referring to. But note that the OP is
writing a .Net DLL that will be used as a COM Add-In. Consequently,
one doesn't have access to 'Application' but needs to establish one at
add-in initialization time through a variable s/he declares in the COM
Add-in.

Further, and you may already know the answer to this, but I don't, one
should check the interaction between XL, the COM Add-In, and the XL
InputBox dialog box. Will it still be modal? I know that if one has a
userform in a COM Add-In, one needs to take special steps to make it
modal and to ensure it shows within the XL window. Further, it is not
possible to use a RefEdit control in such a userform. Well, one can
create one but it doesn't work. Does InputBox with Type=8 have the
same problem?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
Sorry, I could have been a little more detailed. here is a sample that
shows what I'm talking about:

Sub tryIt()
Dim res As Range
Dim def As Range

Set def = Application.Selection

Set res = Application.InputBox("Select the range of cells",
Type:=8, _
Default:=def.AddressLocal)

MsgBox res.Address

End Sub

The Type:=8 tells it to let the user select a range. The
Default:=def.AddressLocal gets the range the user already has selected.
This way, if the user already has a range selected, they only have to
click OK, but if they initiated the action and didn't realize they
needed to pre-select the range, the InputBox allows to select it.

Also, to make sure your application is robust, you should verify the
type of the Selection before assigning it to the def range object. The
user's current selection could be a chart or an autoshape, either of
which would cause the above sample to throw an error.