Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA 'set typelib = createobject("scriptlet.typelib")' Permission Denied [duplicate]

Tags:

excel

vba

I have a problem with my code which seems to have cropped up over night. There are some peculiarities with this so I'll try to give as much detail as I can.

The file in question is an excel workbook which generates an xml file from data passed in. The file is opened, populated and saved via a macro, and this section runs fine.

The problem occurs when creating a GUID for the .xml, in this routine:

Function GenGUID() As String

Dim strGUID As String
Dim TypeLib As Object

Set TypeLib = CreateObject("Scriptlet.TypeLib")
strGUID = TypeLib.guid

'dump the curly brackets
strGUID = Replace(strGUID, "{", "")
strGUID = Replace(strGUID, "}", "")

strGUID = Left(strGUID, Len(strGUID) - 2)

GenGUID = strGUID

End Function

Specifically, the line:

Set TypeLib = CreateObject("Scriptlet.TypeLib")

This throws up a "Runtime error 70: Permission Denied".

Now, the peculiarities.

  • Out of 4 machines the file was tried on, it works on one of them.
  • The user of the 'working' machine has tried running the file on the other 3 machines to no avail.
  • Of the 3 'broken' machines, 2 had updates installed overnight and the other hadn't had updates installed in a few days. The 'working' machine hasn't had updates installed since February.
  • The administrator account has tried running the file to rule out an overnight permissions update.
  • The file ran fine yesterday (12th Jul 2017) on one of the 'broken' machines.
  • All reference libraries have been checked and they match with the 'working' machine.
  • The Excel version in use on all 4 machines is 2013 Pro.

The stand out above is the updates issue. But, the machine the file ran fine on yesterday was the 'broken' machine not updated overnight, ruling this out.

We have tried everything we can think of, along with a lot of internet trawling for answers. All coming up with nothing.

Does anyone have any ideas?

Thanks in advance for any help.

like image 221
JAtterton Avatar asked Jul 13 '17 13:07

JAtterton


1 Answers

The KB3213624 seems to be the Office 2010 Security Update. Below are the KBs for other versions of MS Office:

Microsoft Office 2013 Service Pack 1 (64-bit editions)      3213555 
Microsoft Office 2013 Service Pack 1 (32-bit editions)      3213555 
Microsoft Office 2007 Service Pack 3                        3213640
Microsoft Office 2016 (32-bit edition)                      3213545
Microsoft Office 2010 Service Pack 2 (32-bit editions)      3213624 
Microsoft Office 2010 Service Pack 2 (64-bit editions)      3213624
Microsoft Office 2013 RT Service Pack 1                     3213555
Microsoft Office 2016 (64-bit edition)                      3213545
like image 147
tony722 Avatar answered Oct 16 '22 12:10

tony722