Matt Ridge
Matt Ridge

Reputation: 3651

ThisWorkbook vs opened_workbook?

What is the difference between ThisWorkbook and opened_workbook?

I only ask because I am looking through some of my old code and I am seeing both being used, I am attempting to clean up some of this code.

As far as I know ThisWorkbook will always dictate the workbook in which the script is being run in, and opened_workbook is the workbook that is at the forefront? Am I wrong here?

I'd like to know not only if I'm right or wrong, but where both should be used, because I have a feeling I should be using ThisWorkbook instead of opened_workbook in my case.

Thanks in advance for trying to help me understand here.

Upvotes: 0

Views: 271

Answers (1)

hazard
hazard

Reputation: 78

ThisWorkbook is a variable that represents an Application-object.

opened_workbook must be a variable.

Upvotes: 2

Related Questions