Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Illegel Error on a Function Call

Hello Experts,
I have Excel 97 Pro on Win98SE.

I have certain piece of code which *was* fully functional. Then I lost
Windows folder somehow. I did a fresh installation of Windows 98. Now the
same piece of code is causing following error on a function call:

==================================
EXCEL caused an invalid page fault in
module <unknown at 0000:01fd0432.
Registers:
EAX=01fd027c CS=0167 EIP=01fd0432 EFLGS=00010202
EBX=01fb4270 SS=016f ESP=0062ca80 EBP=0062cb4c
ECX=00000006 DS=016f ESI=01fdf271 FS=111f
EDX=01fe0fd0 ES=016f EDI=0062ca98 GS=0000
Bytes at CS:EIP:
00 a0 e8 27 fc 01 70 04 fd 01 fc c6 00 00 00 00
Stack dump:
65255d43 0062ca98 004ffb80 0062cab0 0062caac 0062caa8 00000000 00000000
00000000 00000000 00000000 ffffffff 01fe11fc 00010000 00000000 00000000
==================================



Here is the code:

'----------------------------------------------------------
Option Explicit

Public Function Join(source() As String, Optional _
sDelim As String = " ") As String
Dim sOut As String, iC As Integer
On Error GoTo errh:
For iC = LBound(source) To UBound(source) - 1
sOut = sOut & source(iC) & sDelim
Next
sOut = sOut & source(iC)
Join = sOut
Exit Function
errh:
Err.Raise Err.Number
End Function

Public Function Split(ByVal sIn As String, Optional sDelim As _
String, Optional nLimit As Long = -1, Optional bCompare As _
Long = vbBinaryCompare) As Variant
Dim sRead As String, sOut() As String, nC As Integer
If sDelim = "" Then
Split = sIn
End If
sRead = ReadUntil(sIn, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit < -1 And nC = nLimit Then Exit Do
sRead = ReadUntil(sIn, sDelim)
Loop While sRead < ""
ReDim Preserve sOut(nC)
sOut(nC) = sIn
Split = sOut
End Function

Public Function ReadUntil(ByRef sIn As String, _
sDelim As String, Optional bCompare As Long _
= vbBinaryCompare) As String
Dim nPos As String
nPos = InStr(1, sIn, sDelim, bCompare)
If nPos 0 Then
ReadUntil = Left(sIn, nPos - 1)
sIn = Mid(sIn, nPos + Len(sDelim))
End If
End Function

Public Function StrReverse(ByVal sIn As String) As String
Dim nC As Integer, sOut As String
For nC = Len(sIn) To 1 Step -1
sOut = sOut & Mid(sIn, nC, 1)
Next
StrReverse = sOut
End Function

Public Function InStrRev(ByVal sIn As String, sFind As String, _
Optional nStart As Long = 1, Optional bCompare As _
Long = vbBinaryCompare) As Long
Dim nPos As Long
sIn = StrReverse(sIn)
sFind = StrReverse(sFind)
nPos = InStr(nStart, sIn, sFind, bCompare)
If nPos = 0 Then
InStrRev = 0
Else
InStrRev = Len(sIn) - nPos - Len(sFind) + 2
End If
End Function

Public Function Replace(sIn As String, sFind As String, _
sReplace As String, Optional nStart As Long = 1, _
Optional nCount As Long = -1, Optional bCompare As _
Long = vbBinaryCompare) As String

Dim nC As Long, nPos As Integer, sOut As String
sOut = sIn
nPos = InStr(nStart, sOut, sFind, bCompare)
If nPos = 0 Then GoTo EndFn:
Do
nC = nC + 1
sOut = Left(sOut, nPos - 1) & sReplace & _
Mid(sOut, nPos + Len(sFind))
If nCount < -1 And nC = nCount Then Exit Do
nPos = InStr(nStart, sOut, sFind, bCompare)
Loop While nPos 0
EndFn:
Replace = sOut
End Function

'----------------------------------------------------------

This code was provided by MS on a web page whose address I have forgotten.
Note that this code was fully functional before the fresh installation of
Windows 98. But now the call to Split() function (n this code) is causing
the above-mentioned error.
Any ideas?
What should I do now?

Thank you,
--
Syed Zeeshan Haider


-----------------------------------------------------
http://szh.20m.com/
http://gomusharrafgo.20m.com/


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Illegel Error on a Function Call

Syed,
I would assume that it is being treated as the VBA version of the function
call.
Try typing "VBA." and see "Split" apears as an option.

NickHK

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have certain piece of code which *was* fully functional. Then I lost
Windows folder somehow. I did a fresh installation of Windows 98. Now the
same piece of code is causing following error on a function call:

==================================
EXCEL caused an invalid page fault in
module <unknown at 0000:01fd0432.
Registers:
EAX=01fd027c CS=0167 EIP=01fd0432 EFLGS=00010202
EBX=01fb4270 SS=016f ESP=0062ca80 EBP=0062cb4c
ECX=00000006 DS=016f ESI=01fdf271 FS=111f
EDX=01fe0fd0 ES=016f EDI=0062ca98 GS=0000
Bytes at CS:EIP:
00 a0 e8 27 fc 01 70 04 fd 01 fc c6 00 00 00 00
Stack dump:
65255d43 0062ca98 004ffb80 0062cab0 0062caac 0062caa8 00000000 00000000
00000000 00000000 00000000 ffffffff 01fe11fc 00010000 00000000 00000000
==================================



Here is the code:

'----------------------------------------------------------
Option Explicit

Public Function Join(source() As String, Optional _
sDelim As String = " ") As String
Dim sOut As String, iC As Integer
On Error GoTo errh:
For iC = LBound(source) To UBound(source) - 1
sOut = sOut & source(iC) & sDelim
Next
sOut = sOut & source(iC)
Join = sOut
Exit Function
errh:
Err.Raise Err.Number
End Function

Public Function Split(ByVal sIn As String, Optional sDelim As _
String, Optional nLimit As Long = -1, Optional bCompare As _
Long = vbBinaryCompare) As Variant
Dim sRead As String, sOut() As String, nC As Integer
If sDelim = "" Then
Split = sIn
End If
sRead = ReadUntil(sIn, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit < -1 And nC = nLimit Then Exit Do
sRead = ReadUntil(sIn, sDelim)
Loop While sRead < ""
ReDim Preserve sOut(nC)
sOut(nC) = sIn
Split = sOut
End Function

Public Function ReadUntil(ByRef sIn As String, _
sDelim As String, Optional bCompare As Long _
= vbBinaryCompare) As String
Dim nPos As String
nPos = InStr(1, sIn, sDelim, bCompare)
If nPos 0 Then
ReadUntil = Left(sIn, nPos - 1)
sIn = Mid(sIn, nPos + Len(sDelim))
End If
End Function

Public Function StrReverse(ByVal sIn As String) As String
Dim nC As Integer, sOut As String
For nC = Len(sIn) To 1 Step -1
sOut = sOut & Mid(sIn, nC, 1)
Next
StrReverse = sOut
End Function

Public Function InStrRev(ByVal sIn As String, sFind As String, _
Optional nStart As Long = 1, Optional bCompare As _
Long = vbBinaryCompare) As Long
Dim nPos As Long
sIn = StrReverse(sIn)
sFind = StrReverse(sFind)
nPos = InStr(nStart, sIn, sFind, bCompare)
If nPos = 0 Then
InStrRev = 0
Else
InStrRev = Len(sIn) - nPos - Len(sFind) + 2
End If
End Function

Public Function Replace(sIn As String, sFind As String, _
sReplace As String, Optional nStart As Long = 1, _
Optional nCount As Long = -1, Optional bCompare As _
Long = vbBinaryCompare) As String

Dim nC As Long, nPos As Integer, sOut As String
sOut = sIn
nPos = InStr(nStart, sOut, sFind, bCompare)
If nPos = 0 Then GoTo EndFn:
Do
nC = nC + 1
sOut = Left(sOut, nPos - 1) & sReplace & _
Mid(sOut, nPos + Len(sFind))
If nCount < -1 And nC = nCount Then Exit Do
nPos = InStr(nStart, sOut, sFind, bCompare)
Loop While nPos 0
EndFn:
Replace = sOut
End Function

'----------------------------------------------------------

This code was provided by MS on a web page whose address I have forgotten.
Note that this code was fully functional before the fresh installation of
Windows 98. But now the call to Split() function (n this code) is causing
the above-mentioned error.
Any ideas?
What should I do now?

Thank you,
--
Syed Zeeshan Haider


-----------------------------------------------------
http://szh.20m.com/
http://gomusharrafgo.20m.com/




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Illegel Error on a Function Call

"NickHK" wrote in message ...
Syed,
I would assume that it is being treated as the VBA version of the function
call.
Try typing "VBA." and see "Split" apears as an option.


As a matter of fact, Split() function was not available until VBA6 while
Excel 97 Pro uses VBA5. That's why MS has provided these functions for VBA5
users on their site and I copied those functions for the reference.

Thanks,
--
Syed Zeeshan Haider


-----------------------------------------------------
http://szh.20m.com/
http://gomusharrafgo.20m.com/


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time Error '5' - Invalid procedure call or argument Trefor Excel Discussion (Misc queries) 2 December 17th 07 03:32 AM
Runtime Error! R6025 -pure virtual function call STINEHART Excel Discussion (Misc queries) 4 December 7th 06 04:06 PM
Run-time error '5': Invalid Procedure Call or Argument Nikila Excel Discussion (Misc queries) 2 February 24th 06 09:26 PM
ODBC Call failed Error 3146 only on some PC's Jay_44 Excel Programming 3 October 7th 03 05:53 PM
Run-time error '5':Invalid Procedure call or argument Jan Refsdal Excel Programming 1 July 25th 03 05:14 AM


All times are GMT +1. The time now is 07:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"