Invalid procedure call or argument: 'mid' - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Invalid procedure call or argument: 'mid'

nitewriternitewriter Posts: 1Member
Hi, Can someone help me with this error...I started getting this error msg on a program that use to work fine without error, the error msg is "Invalid procedure call or argument: 'mid'
this is the code:
function GenerateBlanks(str)
dim i
dim result
result=""
for i=1 to len(str)
if (mid(str,i,1)="*") then
result= result & " "
else
result= result & mid(str,i,1)
end if
next
GenerateBlanks = result
end function

pos=instr(1,part1,"~")
fname=mid(part1,1,pos-1)
part1=mid(part1,pos+1)

The error comes on line with the code - fname=mid(part1,1,pos-1)

I need help


Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : Hi, Can someone help me with this error...I started getting this
    : error msg on a program that use to work fine without error, the
    : error msg is "Invalid procedure call or argument: 'mid'
    : this is the code:
    : function GenerateBlanks(str)
    : dim i
    : dim result
    : result=""
    : for i=1 to len(str)
    : if (mid(str,i,1)="*") then
    : result= result & " "
    : else
    : result= result & mid(str,i,1)
    : end if
    : next
    : GenerateBlanks = result
    : end function
    :
    : pos=instr(1,part1,"~")
    : fname=mid(part1,1,pos-1)
    : part1=mid(part1,pos+1)
    :
    : The error comes on line with the code - fname=mid(part1,1,pos-1)
    :
    : I need help
    :
    :
    :

    I suspect pos-1 is negative. Set a debugger breakpoint and run through the code to be sure.
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.