I have been using Excel VBA for a while now and I have come across a problem that I have never encountered before. I am using someone elses computer that is set up as Polish, so the decimal separator is set to comma. But even when I had my computer set up similarly in the past I did not have any problem.
This current project creates a drawing in Visio.
So,
I have a variable of type double that is calculated as pgeWidth = 550 / 1.4
What I would expect is that VBA would calculate pageWidth = 392.857...
However what VBA is doing is pgeWidth = 392,857...
If I put a break in and check the value of pgeWidth it shows the value with a comma separator. pgeWidth is then set to the page width property in Visio which thinks it should be 392857.... mm wide which obviously gives an error.
Why is VBA using a comma decimal separator instead of a point?
如果要进一步用point传递值,请考虑将变量转换为字符串,然后用point替换逗号:
pgeWidth = replace(CStr(pgeWidth), ",",".")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.