Reputation: 40499
I have code like this which opens Word documents for editing from our intranet, obviously called when the related button is clicked:
Dim objWord
Sub Btn956_onclick()
call OpenDoc("\\server01\folder1\docname.docx")
End Sub
Sub OpenDoc(strLocation)
Set objWord = CreateObject("Word.Application")
objWord.Visible = true
objWord.Documents.Open strLocation
End Sub
To get this to work in IE (our standard browser for staff), I need to get them to do a one-off change to their internet security settings (otherwise they just get a javascript error). In particular, the "Initialize and script ActiveX controls not marked as safe" setting for the Intranet Zone is changed from disable to enable.
To help users get this setting updated without technical help, I need a way of notifying them that the setting needs to be changed when it's not correctly set. Is there a way I can programmatically detect that the above OpenDoc command is failing because they haven't updated their settings?
Upvotes: 1
Views: 1270
Reputation: 42182
You would have to read the registry to do so. But the place where is OS and IE version dependent. eg for IE6 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings and HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings and probably others too.
It depends on the security zone your site is in also. To read the registry in your script the user would need enough permissions. On the other side if the user has enough rights you could set the setting right from your script, he should just have to comfirm some prompt i presume.
I think your best bet is to set the setting right with group policy and distribute these setting to the workstations. If you don't use group policies you could seek and test the right registry keys and the distribute through a logon script or by letting them manually load a .reg file by doubleclicking it.
Upvotes: 1