When a pass a range when calling a SubRoutine, the range get lost on the process.
I've got two modules:
- Final
On the Email Module i've got this sub:
Sub Send_Email(Type, MSG, operation, Optional RangeB As Range, Optional txtpath)
The parameter "Type" is either 1 or 2.
If i put 1 the sub will send an e-mail with a file.txt as an attachment. And if i put 2 the sub will put the range in the email body. That's why both RangeB and txtpath are optional parameters.
The attachment one works fine.
But when i put a range as parameter, RangeB cant be selected.
"RangeB.Select" -> ERROR (select method of range class failed)
I've tryed calling the sub by two different ways:
Call Send_Email(2, var_MSG, var_Op, Range("RangeBalko"))
Call Send_Email(2, var_MSG, var_Op, Templates.Range("RangeBalko"))
Templates -> ThisWorkbook.Sheets("Templates")
Someone knows how to resolve this issue ?
Best Regards!!