Change active sheet

Change active sheet

AlbertoOutline
Participant Participant
2,475 Views
2 Replies
Message 1 of 3

Change active sheet

AlbertoOutline
Participant
Participant

Hi everyone, I need to change active sheet by vba code in a drawing document.

 

How can I set DrawingDocument.ActiveSheet Property?

 

Thank in advance

0 Likes
Accepted solutions (1)
2,476 Views
2 Replies
Replies (2)
Message 2 of 3

AlbertoOutline
Participant
Participant
Accepted solution

Solved! Smiley Very Happy

 

ThisApplication.ActiveDocument.Sheets(sheet number).Activate

Message 3 of 3

_KarlH
Enthusiast
Enthusiast

Worth noting that Sheets also accepts the Sheet Name too, might make it easier to trace and troubleshoot.

 

Example below;

 

Sub Main()

	oDrawDoc = ThisApplication.ActiveDocument

	For Each oSheet In oDrawDoc.Sheets
		ThisApplication.ActiveDocument.Sheets(oSheet.Name).Activate
		Logger.Info("Sheet " + oSheet.Name + " is now active.")
		'Sub_routine_goes_here()
	Next
End Sub

 

0 Likes