[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

Run time error 13

Running MS Word 2003 and have a line of code that I'm getting  Run time Error 13, type mismatch.  If I place a break point on the line and execute the code... when it hits the line I continue exuection and the code runs fine.  If I remove the break point and let it run, I get the error??????

Any ideas?

HoursWorked = Trim(Right(SearchString, 8))

Thanks.
0
thandel
Asked:
thandel
  • 2
  • 2
1 Solution
 
Chris BottomleyCommented:
Is the variable type numerical and can you be sure the substrong is numerical
0
 
thandelAuthor Commented:
SearchString is a string but after right/triming its a number... besides why would stepping through it work and full execution not?
0
 
Chris BottomleyCommented:
>>> besides why would stepping through it work and full execution not?

Not sure but I was asking after HoursWorked ... for example if the trimmed variable SearchString is blank then the 'conversion' would fail.

try for example

dim tmp as variant

tmp = Trim(Right(SearchString, 8))
if tmp = "" then
    HoursWorked = 0
elseif isnumeric(tmp) then
    HoursWorked
else
    HoursWorked = 0
end if

Open in new window


And does it still fail?

Chris
0
 
thandelAuthor Commented:
I'll look into why but a variable is not getting set "SearchString" however it is when I setp through it.  Your solution helps as a "band aid" but I can't see why its not getting set.

Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now