VBA CreateObject() not working in 2016 x64

Sephaerius

New Member
Joined
May 30, 2013
Messages
45
I'm using the GetBoiler function by Ron de Bruin to grab an Outlook signature for an email VBA function. This function has historically worked perfectly in 2013 x64, however I have recently been upgraded by my organization to 2016 x64, and the CreateObject() command now throws error 429 ActiveX component can't create object.
I've Googled all morning to try to figure out the fix or workaround, with no luck. The most I was able to find was someone who commented that "something changed" with objects between 2013 and 2016, but it wasn't specified what, or how to repair it.

Code:
Function GetBoiler(ByVal sFile As String) As String
    Dim fso As Object
    Dim ts As Object
    Set fso = CreateObject("Scripting.FileSystemObject")      '<-- error on this line
    Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
    GetBoiler = ts.readall
    ts.Close
End Function

So far I've checked my Trust Center settings, my Internet Security settings, I've run a Repair on Office 2016, I've run Regsvr32, and I've checked my References. I'm at my wits end on troubleshooting this - so if anyone has any suggestions to walk through please help!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
did you check library Reference "Microsoft Scripting RunTime" is available ?

And if Yes then

try using Early Binding.
 
Upvote 0
did you check library Reference "Microsoft Scripting RunTime" is available ?

And if Yes then

try using Early Binding.

Yes, that reference is checked.

So if I change to Early Binding, like this, I assume:
Code:
Dim fso As Scripting.FileSystemObject

What do I then Set fso as?
 
Upvote 0
Run this code and let me know if you can run it without any issue.

Don't forget to add library reference.

Code:
'Creating a FileSystemObject
Public FSO As New FileSystemObject
Sub DiskSpace()
Dim drv As Drive
Dim Space As Double
Set drv = FSO.GetDrive("C:") ' Creating the the Drive object
Space = drv.FreeSpace
Space = Space / 1073741824 'converting bytes to GB
Space = WorksheetFunction.Round(Space, 2) ' Rounding
MsgBox "C: has free space = " & Space & " GB"
End Sub
 
Upvote 0
Run this code and let me know if you can run it without any issue.

Don't forget to add library reference.

Code:
'Creating a FileSystemObject
Public FSO As New FileSystemObject
Sub DiskSpace()
Dim drv As Drive
Dim Space As Double
Set drv = FSO.GetDrive("C:") ' Creating the the Drive object
Space = drv.FreeSpace
Space = Space / 1073741824 'converting bytes to GB
Space = WorksheetFunction.Round(Space, 2) ' Rounding
MsgBox "C: has free space = " & Space & " GB"
End Sub

I get Run-time error 424: Object required, hitting on line 3 Set drv...
I do have Microsoft Scripting Runtime checked in my References. Is there another reference I need?
 
Last edited:
Upvote 0
okay,that's strange.

can you go to library Reference window ----- and check if there is anything says "Missing".
 
Upvote 0
usually it shows at top (check first 15-20 reference)
 
Upvote 0
Strange indeed, and nope, no missing references.


close out of all excel file, open new one .
Add reference
paste entire code and then try.

let me do the some research I will get back to you.
 
Upvote 0
close out of all excel file, open new one .
Add reference
paste entire code and then try.

let me do the some research I will get back to you.

OK, doing that worked. However, note that this test code doesn't contain the CreateObject() line that's causing my initial issue.
 
Upvote 0

Forum statistics

Threads
1,223,957
Messages
6,175,625
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top