Created
December 16, 2014 23:50
-
-
Save auycro/d93e2449dad894afc908 to your computer and use it in GitHub Desktop.
microsoft-script-encode-vbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Option Explicit | |
'Sub aa() | |
Dim oEncoder, oFile, oFSO 'As Object | |
Dim oStream, sSourceFile | |
Dim sDest, sFileOut, oEncFile | |
Set oEncoder = CreateObject("Scripting.Encoder") | |
Set oFSO = CreateObject("Scripting.FileSystemObject") | |
Set oFile = oFSO.GetFile("C:\ExcelMacro.vbs") | |
Set oStream = oFile.OpenAsTextStream(1) | |
sSourceFile = oStream.ReadAll | |
oStream.Close | |
sDest = oEncoder.EncodeScriptFile(".vbs", sSourceFile, 0, "") | |
sFileOut = "C:\ExcelMacroEncoded.vbe" | |
Set oEncFile = oFSO.CreateTextFile(sFileOut) | |
oEncFile.Write sDest | |
oEncFile.Close | |
'End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment