ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   object variable or with block variable not set mean (https://www.excelbanter.com/excel-programming/390624-object-variable-block-variable-not-set-mean.html)

Rick

object variable or with block variable not set mean
 
What does object variable or with block variable not set
really mean?
I have the statement coded as thus:

This part declared in declarations:
Public ThsWrkBk As Workbook

This part executed in a Public Static procedu
Dim ThsWrkBk
Set ThsWrkBk = ActiveWorkbook

This part executed in a Public procedure using
Public PostPymnt(ThsWrkBk, ShtNme)
ThsWrkBk.Active

Norman Jones

object variable or with block variable not set mean
 
Hi Rick,

It would be better if you were to post the actual code.

However, perhaps, try deleting:

Dim ThsWrkBk


and try changing:

ThsWrkBk.Active


to

ThsWrkBk.Activate.



---
Regards,
Norman

"Rick" wrote in message
...
What does object variable or with block variable not set
really mean?
I have the statement coded as thus:

This part declared in declarations:
Public ThsWrkBk As Workbook

This part executed in a Public Static procedu
Dim ThsWrkBk
Set ThsWrkBk = ActiveWorkbook

This part executed in a Public procedure using
Public PostPymnt(ThsWrkBk, ShtNme)
ThsWrkBk.Active




Rick

object variable or with block variable not set mean
 
Thanks Norman it worked

"Norman Jones" wrote:

Hi Rick,

It would be better if you were to post the actual code.

However, perhaps, try deleting:

Dim ThsWrkBk


and try changing:

ThsWrkBk.Active


to

ThsWrkBk.Activate.



---
Regards,
Norman

"Rick" wrote in message
...
What does object variable or with block variable not set
really mean?
I have the statement coded as thus:

This part declared in declarations:
Public ThsWrkBk As Workbook

This part executed in a Public Static procedu
Dim ThsWrkBk
Set ThsWrkBk = ActiveWorkbook

This part executed in a Public procedure using
Public PostPymnt(ThsWrkBk, ShtNme)
ThsWrkBk.Active





Ben McBen

object variable or with block variable not set mean
 
Yo are redifining ThsWrkBk with local scope, and this will take precedence
over the one you defined in your declarations. Dont (re)dim it in the proc.

"Rick" wrote:

What does object variable or with block variable not set
really mean?
I have the statement coded as thus:

This part declared in declarations:
Public ThsWrkBk As Workbook

This part executed in a Public Static procedu
Dim ThsWrkBk
Set ThsWrkBk = ActiveWorkbook

This part executed in a Public procedure using
Public PostPymnt(ThsWrkBk, ShtNme)
ThsWrkBk.Active



All times are GMT +1. The time now is 01:23 PM.

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