Visio VBA "Expected: end of statement" error

This has me stumped. It worked fine when I first wrote this code a few days ago. Now, though, it is as if Visio thinks the syntax is incomplete or incorrect. I am getting this error:enter image description here

I wondered if it had anything to do with the file type, but I already have other macro subs from way back just above this in the same module and they don't throw any errors.

I'd be grateful for any clues anyone has...

Notes:

  • VBA v7.1
  • Visio Plan 2 (16.0.12527.21096)
  • Macros Security off (all macros allowed)
  • VBA Module is contained in/saved as a Visio 2013 Stencil
  • Visio Document on which I am trying to run the VBA is a Macro-Enabled Visio Drawing (.vsdm)
5

1 Answer

OK, so kudos to Paul Herbert for sending me down the right path...though what I am about to reveal is a little more sinister than I expected...

I thought maybe I might find that I only had LF instead CRLF as EOL (End-of-Line) characters. It turns out the issue was that all of the leading spaces were double byte characters - looks like Unicode...Beyond Compare Text

Thank God for Beyond Compare (from Scooter Software. So worth the money! No they are not paying me...)

...but is it really Unicode?

Here is what is really going on underneath:Beyond Compare Hex

...I don't think it is Unicode, since Unicode 0xA020 is

How this happened is a mystery to me, but I suspect it may have something to do with the fact that the original Visio Stencil I typed this into was in the old .VSS format (from way back), and I think there may have been some kind of encoding issue with how current Visio processed it upon re-opening the Stencil...some compatibility bug between Visio and old file versions, maybe.

It could be a sequence of Non-Breaking Spaces (0xA0) and Spaces (0x20).

Problem solved, though.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like