Nov 24 2018 07:30 AM
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
Workbooks(wbname$).Activate
Exit Sub
ChangeStatts:
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