Sub OpenFile(strFilename As String)
Dim intFIndex As Integer
Dim lngLenFile As Long
Dim lngBytes As Long
On Error GoTo error_open_Exe
' Abrir archivo seleccionado
If strFilename <> "" Then
If Dir(strFilename) <> "" Then
intFIndex = FreeFile
Close #intFIndex
Screen.MousePointer = 11
Open strFilename For Binary As #intFIndex
lngLenFile = LOF(intFIndex)
ReDim GetByt(1 To lngLenFile) As Byte '<---
Get #intFIndex, , GetByt()
' Convertir a String
gstrExe = GetByt()
'Reset array
ReDim GetByt(1 To 1)
Close #intFIndex
gstrWorkDir = Path(strFilename)
Call WriteWorkingDir
Else
gstrText = "El archivo no existe"
MsgBox gstrText, vbExclamation, gstrAppTitle
End If
End If
Screen.MousePointer = vbDefault
Exit Sub
error_open_Exe:
gstrText = "Error al abrir archivo"
MsgBox gstrText, vbExclamation, gstrAppTitle
Screen.MousePointer = vbDefault
Exit Sub
End Sub
Sub SaveFileAs(Filename)
Dim lngLenExe As Long
On Error Resume Next
Open Filename For Binary As #1
Screen.MousePointer = 11
' Escribir contenido de la variable en modo de 16 bit
lngLenExe = LenB(gstrExe)
ReDim PutByt(1 To lngLenExe) As Byte
PutByt() = gstrExe
Put #1, , PutByt()
Close #1
Screen.MousePointer = 0
If Err Then
MsgBox Error, 48, App.Title
End If
End Sub