Jump to content

decimal turning into comma? vba


Proctor

Recommended Posts

Hello: I created a program that's been working perfect; however, I recently placed it on a machine and it wasn't working and so of coarse I debugged it and found out that when it's getting the length of the spline, for some reason placing a comma in where there use to be a decimal e.g 5.123 becomes 5,123. it's very strange.

 

here's the bit of code that's running:

 

If TypeOf ssobject Is AcadSpline Then
           Set MySpline = ssobject
           MyLineType = MySpline.Linetype
           'THIS SCRIPT SENDS IN PARAMS and calls A LISP FUNCTION TO CALCULATE THE LENGTH OF A SPLINE
           'WASNT ABLE TO FIND LENGTH W/ VBA SO HAD TO MAKE CALL LISP FUNCTION vlax-curve-getdistatparam to get it.
           With ThisDrawing
               ThisDrawing.SetVariable "USERR1", sVar
               'load lisp
               .SendCommand "(vl-load-com)" & vbCr
               'call lisp function and pass in params. return length of spline
               strCom = "(setvar " & Chr(34) & "USERR1" & Chr(34) & Chr(32) & "(vlax-curve-getdistatparam (vlax-ename->vla-object (handent " & Chr(34) & ssobject.Handle & Chr(34) & ")) (vlax-curve-getendparam (vlax-ename->vla-object (handent " & Chr(34) & ssobject.Handle & Chr(34) & ")))))" & vbCr
               .SendCommand strCom
               [color=red] MyLineLength = .GetVariable("USERR1")[/color]
           End With
End if

 

The line in red is when it gets the length of the spline and i see the comma instead of the decimal.

 

Thanks for your help,

Proctor

Link to comment
Share on other sites

Please check Control Panel --> Regional And Language Options --> Customize... for that station; most probably the decimal separator symbol is set to comma.

 

Regards,

Link to comment
Share on other sites

msasu ...that resolved it!!! Thank you so much for letting me know about this setting!!!

 

Proctor

Link to comment
Share on other sites

You're welcome! Glad to help you.

 

But my suggestion is to add a protection in your code for such cases (i.e. a custom function for conversion string-to-double).

 

Regards,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...