#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default add-in

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default add-in

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

--
regards,
Tom Ogilvy

"jim c." wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default add-in

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").addr ess

Sorry, working with add-in are new to me.
TIA


-----Original Message-----
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

--
regards,
Tom Ogilvy

"jim c." wrote in message
...
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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default add-in

I have been successful with

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

--
Regards,
Tom Ogilvy


"jim c." wrote in message
...
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").addr ess

Sorry, working with add-in are new to me.
TIA


-----Original Message-----
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

--
regards,
Tom Ogilvy

"jim c." wrote in message
...
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



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default add-in

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


"jim c." wrote in message
...
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


-----Original Message-----
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

--
regards,
Tom Ogilvy

"jim c." wrote in message
...
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


.



.

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



All times are GMT +1. The time now is 10:33 AM.

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

About Us

"It's about Microsoft Excel"