ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin active sheet problem (https://www.excelbanter.com/excel-programming/347804-addin-active-sheet-problem.html)

[email protected]

Addin active sheet problem
 
I wrote a search form which works well as an Excel file, however, when
I converted it to an addin it throws up this error...

Object variable or with block variable not set

When I click on debug is highlights this part of the code

Set shtSearch = ThisWorkbook.ActiveSheet
Locate TextBox1.Text, shtSearch.Range("A:IV"), blnGotColor,
lngColor

I researched as much as I could on Newsgroups and see that an addin
does not have active sheets but I could not find out how to fix the
problem. Can someone help please?

Many thanks
Tony


Bob Phillips[_6_]

Addin active sheet problem
 
Are you actually wanting to search the addin workbook or another workbook.
It seems to me that ThisWorkbook should probably be replaced with
ActiveWorkbook,

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
I wrote a search form which works well as an Excel file, however, when
I converted it to an addin it throws up this error...

Object variable or with block variable not set

When I click on debug is highlights this part of the code

Set shtSearch = ThisWorkbook.ActiveSheet
Locate TextBox1.Text, shtSearch.Range("A:IV"), blnGotColor,
lngColor

I researched as much as I could on Newsgroups and see that an addin
does not have active sheets but I could not find out how to fix the
problem. Can someone help please?

Many thanks
Tony




[email protected]

Addin active sheet problem
 
Good man Bob - worked a treat!

Cheers
Tony



All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com