Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents("Sheet10")
I have the code above. Currently Sheet10 is named as SummaryTab in the excel tab. I want to refer to the VBComponent using the name in the excel tab. Meaning that I want to use something like
Set VBComp = VBProj.VBComponents("SummaryTab")
However, the above code is giving me errors. how can I fix this?
You can use
Set VBComp = VBProj.VBComponents(Worksheets("SummaryTab").CodeName)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With