add-in

  • Thread starter Thread starter jim c.
  • Start date Start date
J

jim c.

I finished my form which is an architectural calculator.
I'm using one worksheet for calculations. When I save as
an add-in and test loading the add-in, calculations are
being performed on sheet1 of the activeworkbook. I did a
lot of research on net (appearently not enough) and was
warned from Microsoft KB to refer code in add-in to
thisworkbook. So I changed all my code to...

Thisworkbook.Activesheet.Range(".............

Now i get error Object variable or with block variable not
set...

Any ideas?
TIA
 
Activesheet refers to the sheet visible on the screen that has the focus.

Thisworkbook refers to the workbook containing the code.

if Thisworkbook refers to the addin, then it is unlikely that the addin will
ever be the parent of the activesheet.

If you want to refer to something in the addin, use

Thisworkbook.worksheets("sheetname").Whatever

to refer to the activesheet

ActiveSheet.Whatever
 
Thanks, I understand now. One more problem...
Trying to set the rowsource property for the listbox.

Set rng = ThisWorkbook.Worksheets("Sheet1").Range("a1")
rng.Name = "frmList"
Listbox1.Rowsource = "frmList"

This is still returning values from Activesheet. I have
also tried...

Listbox1.Rowsource = _
ThisWorkbook.Worksheets("Sheet1").Range("a1").address

Sorry, working with add-in are new to me.
TIA
 
I have been successful with

Listbox1.Rowsource = _
ThisWorkbook.Worksheets("Sheet1") _
.Range("a1").address(External:=True)
 
Thanks... That was just what I needed... :)
-----Original Message-----
I have been successful with

Listbox1.Rowsource = _
ThisWorkbook.Worksheets("Sheet1") _
.Range("a1").address(External:=True)

--
Regards,
Tom Ogilvy





.
 
Back
Top