I am currently using MS Access 2016 database. I get this compile error below
"compile error User-defined type not defined" at the code where it is Dim oShell As WshShell
Below is the program. I dont understand where the problem is. Can anyone help me.
Sub SetWebControlAsIE9()
Dim sKey As String
Dim oShell As WshShell
Dim vKey As Variant
Dim nErr As Long
Dim bNewStart As Boolean
Set oShell = New WshShell
sKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\msaccess.exe"
On Error Resume Next
vKey = oShell.RegRead(sKey)
nErr = Err.Number
On Error GoTo 0
If nErr = -2147024894 Then
oShell.RegWrite sKey, 9999, "REG_DWORD"
Debug.Print "IE9 Mode set"
bNewStart = True
Else
If vKey <> 9999 Then
oShell.RegWrite sKey, 9999, "REG_DWORD"
Debug.Print "IE9 Mode set"
bNewStart = True
Else
Debug.Print "IE9 Mode is already set"
End If
End If
Set oShell = Nothing
If bNewStart Then
RestartAccess
End If
End Sub
Sub RestartAccess()
If MsgBox("Die Datenbank und Access müssen neu gestartet werden," & vbCrLf & _
"weil die Einstellungen für das WebControl geändert wurden." & vbCrLf & _
"Jetzt neu starten?", vbQuestion Or vbYesNo, "Bestätigen:") = vbYes Then
Dim sExec As String
Dim oShell As Object
sExec = Chr$(34) & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & Chr$(34) & _
" " & Chr$(34) & CurrentDb.Name & Chr$(34)
oShell.Exec sExec
Application.Quit acQuitSaveNone
End If
End Sub