chcarlill Level: Trainee
 Registered: 07-04-2009 Posts: 1
|
excel vb project created in 2000 not working correctly in 2002
This project was developed in excel 2000 and I am trying to use it in 2002 but am getting a error 13 type mismatch. What can I do to correct this. Here is the code.
Option Explicit
Const MapRowOffset As Integer = 5
Const MapHexColOffset As Integer = 21
Const MapDecColOffset As Integer = 4
Public Sub GenerateAndSaveHexFile(HexSavePath As Variant)
' We'll take the relevant data from the EEPROM map and output it appropriately in a new text file. To generate a _
hex file, the SaveAs filepath has been given the extension "*.hex"
Dim HexLine(0 To 64) As String, NewFile As Integer, NumSum As Integer, CheckSumVal As Integer
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer
' MAKE SURE that everything is set properly before writing the hex code
Call ResetCycleRequirementValues
Call TransposeCycleInfo
Application.ScreenUpdating = False
Worksheets("EEPROM Map").Activate
For i = 0 To 63
HexLine(i) = ":10" 'Start of a record
NumSum = 16
NumSum = NumSum + ((i * 16) \ 256)
NumSum = NumSum + ((i * 16) Mod 256)
j = i + MapRowOffset
HexLine(i) = HexLine(i) & Cells(j, MapHexColOffset) 'This cell contains the Offset value
HexLine(i) = HexLine(i) & "00" 'This indicates that we're talking about a data record
' Scan through each column containing hex data and concatenate the columns in a row to generate a hex line, _
also add the Decimal values of the columns to perform a checksum calculation
For k = 0 To 15
l = k + 2
m = k + MapDecColOffset
(THE PROBLEM IS HERE BELOW)
HexLine(i) = HexLine(i) & Cells(j, MapHexColOffset + l)
NumSum = NumSum + Cells(j, m)
Next k
' Take care of the checksum value
NumSum = NumSum And 255
If NumSum <> 0 Then
CheckSumVal = 256 - NumSum
Else
CheckSumVal = 0
End If
HexLine(i) = HexLine(i) & SetHexLength2(CheckSumVal)
Next i
HexLine(64) = ":00000001FF"
NewFile = FreeFile
Open HexSavePath For Output As #NewFile
For i = 0 To 64
Print #NewFile, HexLine(i)
Next i
Close NewFile
Worksheets("Cycle").Activate
Application.ScreenUpdating = True
End Sub
[Edited by chcarlill on 07-04-2009 at 01:35 PM GMT]
|