Question Excel Interop - Using Worksheets Via Worksheet Codename?!

thebatfink

Well-known member
Joined
Mar 29, 2012
Messages
47
Programming Experience
Beginner
Hi,

I'm basically programatically updating a series of workbooks, which are all the same with regards codenames, but may have different sheetnames or positions.
I used to do this with VBA inside excel and the way I could always get to the sheet I required was with the worksheet codename.

I'm trying to move away from VBA and onto VB and for the most part I can do much of what I want to, but I'm really struggling accessing sheets using their codenames. I simply can't rely on the physical position of the worksheet in the book, or the worksheet name (as they tend to get renamed to the week commencing date).

Is there an alternate work around solution to this?

Thanks!
 
Something like this maybe...
[XCODE]For Each wSheet As Worksheet In xlsApp.Worksheets
If wSheet.CodeName = something Then
code here
End If
Next[/XCODE]
 
Last edited:
Back
Top