GUID - Run-time error '70' permission denied - Microsoft Community
- Get link
- X
- Other Apps
we have installed security update kb3213624 , causing issue our excel - vba script:
public function getnewguid() string
getnewguid = mid$(createobject("scriptlet.typelib").guid, 2, 36)
end function
getting error "run-time error '70' permission denied"
uninstalling security update kb3213624 - no more issue.
is bug or expected behaviour latest update?
how fix code if not microsoft bug? suggestions?
thanks.
hello,
this issue design, of july security updates. control blocked security measure prevent malicious code running in office applications. working on getting knowledgebase article out recommended method. until kb ready, i'll post content here:
office vba “error 70” issue since july 2017 security updates
applies to: office 2016, office, 2013, office 2010, office 2007
the issue documented in article has been reported after installing recent updates listed below:
security update office 2013: july 11, 2017 | security update office 2016: july 11, 2017 |
issue: “run-time error ‘70’ permission denied” vba in office applications when using createobject(“scriptlet.typelib”).guid create guid.
here users see when run issue
this issue design. control blocked security measure prevent malicious code running in office applications.
workaround
the preferred method change code use windows api cocreateguid (https://msdn.microsoft.com/en-us/library/windows/desktop/ms688568(v=vs.85).aspx) instead of “createobject(“scriptlet.typelib”).guid”
example of createobject error '70':
dim strguid string
strguid = left$(createobject("scriptlet.typelib").guid, 38)
note: writing code works on both 32-bit , 64-bit office
example of cocreateguid(…): vba7 win64 office 64-bit
‘ no vt_guid available must declare type guid
private type guid_type
data1 long
data2 integer
data3 integer
data4(7) byte
end type
private declare ptrsafe function cocreateguid lib “ole32.dll” (guid guid_type) longptr
private declare ptrsafe function stringfromguid2 lib "ole32.dll" (guid guid_type, byval lpstrguid longptr, byval cbmax long) longptr
function createguidstring()
dim guid guid_type
dim strguid string
dim retvalue longptr
const guidlength long = 39 'registry guid format null terminator {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
retvalue = cocreateguid(guid)
if retvalue = 0 then
strguid = string$(guidlength, vbnullchar)
retvalue = stringfromguid2(guid, strptr(strguid), guidlength)
if retvalue = guidlength then
‘ valid guid string
createguidstring = strguid
end if
end if
end function
alternate workaround
this allow use createobject(“scriptlet.typelib”) lessen security protection added office july 2017 security update.
you can set registry key allow scriptlet.typelib instantiate inside of office applications. when registry key set, office not block use of com control.
-
open registry editor.
-
go to: computer\hkey_local_machine\software\microsoft\office\16.0\common\com compatibility\{06290bd5-48aa-11d2-8432-006008c3fbfc}
-
note: may need search registry find correct location under hkey_local_machine based on installed office version.
-
-
add activationfilteroverride
-
set dword: 1
detailed instructions:
-
click start, click run, type regedit in open box, , click ok.
-
locate , click following key in registry:
hkey_local_machine
-
on edit menu, point find, , enter following in find what: text box:
com compatibility
-
ensure keys selected, , values , data deselected. next select match whole string only, click find next
-
locate , click following key:
{06290bd5-48aa-11d2-8432-006008c3fbfc}
note: if key not present need add it. on edit menu, point new, , click key. type in {06290bd5-48aa-11d2-8432-006008c3fbfc}
-
on edit menu, point new, , click dword (32-bit) value
-
type activationfilteroverride name of dword, , press enter.
-
right-click activationfilteroverride, , click modify.
-
in value data box, type 1 enable registry entry, , click ok.
-
note disable activationfilteroverride setting, type 0 (zero), , click ok.
-
exit registry editor, , restart open office application.
Office / Excel / Microsoft Office Programming / Office 2010
- Get link
- X
- Other Apps
Comments
Post a Comment