Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use Excel-REST without Microsoft Scripting Runtime? #60

Closed
fortm opened this issue Aug 21, 2014 · 4 comments
Closed

Comments

@fortm
Copy link

fortm commented Aug 21, 2014

Thanks Tim!
Is it possible to run these classes without Microsoft Scripting runtime ?
I understand that the dependency is only for Scripting.Dictionary. So, providing a standalone Dictionary implementation is what I was thinking and removing dependency on Scripting.runtime.

I am trying to use Dictionary implementation as below - http://sysmod.wordpress.com/2011/11/24/dictionary-vba-class-update/
but currently running into following error -
"Private Object modules can not be used in public object modules as parameters or return types for public procedures, as public data members, or as public user defined types"

@timhall
Copy link
Member

timhall commented Aug 21, 2014

Hi @fortm You should be able to use your own implementation of Dictionary (as long as it implements Scripting.Dictionary's interface). The error you're receiving is from the Excel-REST classes having an instancing = PublicNotCreatable, so your Dictionary implementation needs to be set to the same (instead of instancing = Private).

Any particular reason you're replacing the Microsoft Scripting runtime? I had thought about doing something similar for Mac support, but without ServerXMLHTTP it didn't seem feasible just yet.

@fortm
Copy link
Author

fortm commented Aug 21, 2014

I am doing a POC right now using Excel-REST and being cautious , in case enabling Scripting might not happen on client Excel since rest of software is not dependent on that. So far, I had good success with Excel-REST and thanks to you

I will try your change and then post how it went

@fortm
Copy link
Author

fortm commented Aug 22, 2014

Instancing part worked right but it failed at this line in RestRequest.FormattedResource() , directly going to RestClient ErrorHandling block

For Each segment In Me.UrlSegments.Keys
Err Number : 92
Err.description : "For loop not initialized"

I see that in implemented Dictionary , Keys() method is implemented as below , so when count is 0, then this might be leading to uninitialized error.

Public Property Get Keys() As String()
Dim vlist() As String, i As Long
If Me.Count > 0 Then
ReDim vlist(0 To Me.Count - 1)
For i = LBound(vlist) To UBound(vlist)
vlist(i) = KeyValuePairs.Item(1 + i).Key '
Next i
Keys = vlist
End If
End Property

@timhall
Copy link
Member

timhall commented Sep 16, 2014

Hi @fortm, I've released VBA-Dictionary which is a drop-in replacement for adding Dictionary support without Scripting.Dictionary. Just add Dictionary.cls to your project and you can remove the dependency on Microsoft Scripting Runtime.

@timhall timhall changed the title Is it possible to run these classes without Microsoft Scripting runtime Is it possible to use Excel-REST without Microsoft Scripting Runtime? Sep 16, 2014
@timhall timhall closed this as completed Sep 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants