0

Today Visio VBA is behaving differently. debug.print 2^2 prints "2 2" and debug.print 5.5^2 gives an error message "Compile error: Expected expression" while debug.print (5.5)^2 gives 30.25.

I don't remember ever seeing this before in the past probably 15 years of VBA programming, I expected to get 4 and 30.25

  • This is quite well covered at https://stackoverflow.com/questions/51264287/vba-power-operator-not-working-as-expected-in-64-bit-vba – Paul Herber Sep 26 '20 at 12:34
  • 1
    Does this answer your question? [VBA power operator (^) not working as expected in 64-bit VBA](https://stackoverflow.com/questions/51264287/vba-power-operator-not-working-as-expected-in-64-bit-vba) – AMC Sep 26 '20 at 22:17

1 Answers1

0

Use 2 ^ 2. The space is important.

Paul Herber
  • 1,150
  • 1
  • 7
  • 12