Skip to content

Fix VBA for .Net4 #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions DotNetToJScript/Resources/vba_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Function Run()
Dim stm As Object, fmt As Object, al As Object
Set stm = CreateObject("System.IO.MemoryStream")

If stm Is Nothing Then
Dim dotnetversion As String
dotnetversion = "%DOTNETVERSION%"

If dotnetversion <> "v2" Then
%MANIFEST%

Set ax = CreateObject("Microsoft.Windows.ActCtx")
Expand Down Expand Up @@ -52,4 +55,4 @@ Function Run()
DebugPrint Err.Description
Err.Clear
End If
End Function
End Function
4 changes: 4 additions & 0 deletions DotNetToJScript/VBAGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public string GenerateScript(byte[] serialized_object, string entry_class_name,
{
string hex_encoded = BitConverter.ToString(serialized_object).Replace("-", "");
StringBuilder builder = new StringBuilder();
string dotnetversion = (version != RuntimeVersion.v2) ? "v4" : "v2";

for (int i = 0; i < hex_encoded.Length; i++)
{
Expand Down Expand Up @@ -119,6 +120,9 @@ public string GenerateScript(byte[] serialized_object, string entry_class_name,
).Replace(
"%ADDEDSCRIPT%",
additional_script
).Replace(
"%DOTNETVERSION%",
dotnetversion
);
}
}
Expand Down