Understanding VBA Code to Manage Workbook Extensions


Hello to the whole family. I am new to VBA programming and I want to understand each line of this code. In fact, this code solves the problem of extensions of Excel workbooks in the VBA


Sub ActivateWorkbook(wbname$)

'Activate the desired Workbook

'Compensates for Hide Extensions of Known File Type Error 'in Excel On Error GoTo ChangeStatts


Exit Sub


Select Case Err Case 9

wbname$ = wbname$ & ".xls"

Workbooks(wbname$).Activate Debug.Print "New Name:   "; wbname$

Case Else

dummy = MsgBox("An Unanticipated Error No." & Str(Err) &

" Occurred !", vbOKOnly, "Error")

End Select End Sub

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies