Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003/2007: weird handling of regional symbols in VBA code

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi.

I'm sorry if this is not a correct place to ask, but I'm really at loss. Here's the situation.

There are two computers (A and B) that have to work with the same Excel application. The application has VBA macros that use strings with native regional (Lithuanian, if it matters) letters. Computer A (actually, the whole group of computers, where the app was successfully working until now) has Office 2003 installed, and the app was developed in this version. Now newer computers B were added to that group, that have Office 2007. All run on Windows XP, all have the same Regional and Language Options settings (including the Language for non-Unicode programs, which is the one that really matters). Now what happens:

When a computer B loads the app, some of native symbols in the program code (only there, worksheets themselves are processed correctly) are replaced with others, which makes macros choke, since string comparison between values taken from a sheet and values present in the code start to give wrong results. Now, if try to I edit the code and type those native letters from the keyboard, they are entered correctly. So I can manually repair those strings to represent correct values, after which the code runs OK. I save the workbook, load it again - everything's all right. I load the workbook on a computer A where Office 2003 runs, and it also recognizes it properly. I save the workbook on that computer, load it on a computer B - and those letters are garbled again.

As I said, regional settings on both computers are identical, as much as I can tell. There's no other (non-Excel, I mean) shared applications between these two groups that would show similar behavior.

Any ideas what can be wrong? Thanks.
 
You state that once it's fixed on a 2007 machine, it runs fine on 2007 machines until it is saved on a 2003 machine.

To me that scream compatibility issue.

I'd make sure that all computers A (Office 2003) have the Office 2007 compatibility pack installed. (Download available here)

If the problem persists, have all users save the files as .xlsx (2007 format) instead of .xls (2003 format).

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Hmm. The Compatibility Pack seems to be what allows 2003 machines to save Office files in 2007 formats. Which might be an useful feature, but as long as 2003 machines stay an overwhelming majority in the park, I'd prefer the file to stay in 2003 format and make 2007 machines read it properly, if possible.

There's another detail I discovered. When I enter the 2007 machine under an account with administrator's privileges (or simply issue a "runas Excel..." with such account's credentials), it *does* read the file properly. So it's not really a compatibility issue but just some weird glitch. Running from a different user but not with administrator privileges doesn't do the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top