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
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
201 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies