I created a Macro recently which checks the row count of an object and if it is < 500 will export the data to Excel. Otherwise, it will present a message that the row count is too high.
I'd like to change this to use variables instead of having the max row count hard coded and I'm having difficultly getting this to work. I currently have a variable called "vMaxRowCount" with a value of 500. In my aforementioned Macro I have the following line:
So this stores the value of the row count of the object in the variable "vRowCount". I'd like to now change this line:
Current: If CellRect.Height > 500 Then
Desired: If ActiveDocument.Variables("vRowCount") > ActiveDocument.Variables("vMaxRowCount") Then
The "Desired" line does not work. I get the error "Object doesn't support this property or method". Can I use variables in a Macro in this way? Any feedback is much appreciated.