Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code compatibility issue


I am facing problem in making code compatible with countries other than
united states

If locale is US :- The value of string variable assigned to Single
variable correctly

Dim my_num_st As String
Dim my_con_single As Single

my_num_st = "0.8"
my_con_single = CSng(my_num_st)

MsgBox (my_con_single) :- Display 0.8 (Correct)


If locale is Europe :- The value of string variable not assigned to
Single variable correctly

Dim my_num_st As String
Dim my_con_single As Single

my_num_st = "0.8"
my_con_single = CSng(my_num_st)

MsgBox (my_con_single) :- Display 8 (Incorrect)

Please help....


--
iamrajy
------------------------------------------------------------------------
iamrajy's Profile: http://www.excelforum.com/member.php...o&userid=28117
View this thread: http://www.excelforum.com/showthread...hreadid=476872

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code compatibility issue


Dim my_num_st As String
Dim my_con_single As Single
Dim dec_sep as String
dec_sep = Application.International(xlDecimalSeparator)
my_num_st = "0.8"
my_num_st = replace(my_num_st,".",dec_sep)
my_con_single = CSng(my_num_st)

MsgBox (my_con_single)

--
Regrards,
Tom Ogilvy


"iamrajy" wrote in
message ...

I am facing problem in making code compatible with countries other than
united states

If locale is US :- The value of string variable assigned to Single
variable correctly

Dim my_num_st As String
Dim my_con_single As Single

my_num_st = "0.8"
my_con_single = CSng(my_num_st)

MsgBox (my_con_single) :- Display 0.8 (Correct)


If locale is Europe :- The value of string variable not assigned to
Single variable correctly

Dim my_num_st As String
Dim my_con_single As Single

my_num_st = "0.8"
my_con_single = CSng(my_num_st)

MsgBox (my_con_single) :- Display 8 (Incorrect)

Please help....


--
iamrajy
------------------------------------------------------------------------
iamrajy's Profile:

http://www.excelforum.com/member.php...o&userid=28117
View this thread: http://www.excelforum.com/showthread...hreadid=476872



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
Compatibility Issue WLMPilot Excel Discussion (Misc queries) 2 May 1st 10 10:23 PM
Compatibility Issue WLMPilot Excel Discussion (Misc queries) 2 March 8th 10 01:43 PM
could the #NAME? error be a compatibility issue? sweetsourpork New Users to Excel 2 November 23rd 07 07:35 PM
Compatibility issue? Excel97/2003 HBj[_3_] Excel Programming 4 January 3rd 05 09:15 PM
Compatibility Issue on VBA commands for Excel Steve C.[_3_] Excel Programming 1 September 6th 04 11:17 AM


All times are GMT +1. The time now is 05:11 AM.

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

About Us

"It's about Microsoft Excel"