tags:

views:

43

answers:

2

Hi, I am exporting .bas files from an .xls file as outlined here: Exporting A VBComponent Code Module To A Text File to check them in into an SVN repo.

I am encountering the following issue which causes a change on the files that is actually not real (or at least not relevant).

statements like these get reformatted:

rngTenors.Cells(i, 1) 
changes into 
rngTenors.cells(i, 1)

(subtle but still different and it gets picked up by the diff tool that I use and hides the real changes on the file in the noise that this generates)

Any idea of ways to prevent this from happening would be appreciated.

+1  A: 

I'm doing something similar but haven't seen what you are experiencing. I'm not using the same export routines but they look similar at first glance.

A couple of questions.

1) Are you using option explicit, and do you have a variable named cell anywhere?

2) If you Commit, then make a few changes, export the .bas file and Commit again, what does the diff look like?

3) Are you opening and diffing the .bas files in a code aware editor (eg: Ultraedit) that may be changing your capitalisation?

I'm just guessing... but VB editor capitalisation can be weird if you name variables the same as methods or properties. Also i don't see why your export would inconsistently export .Cell i'm guessing if it exports to .cell then it should always export to .cell and not be a problem.

These are just some ideas, good luck :)

Mark Nold
Thanks for feedback Mark, I am using option explicit. I will search my code for a variable named cell tomorrow.regarding 2), the diffs in general look like they should (except when this additional unwanted diff gets introduced).3) I am using winmerge as my diffing tool (I think it is not code aware)I think that the explanation with the 'conflicting' variable name sounds likely, will follow up on that, thanks a lot for help!
HKK
A: 

Indeed I found something in the code as was suggested above.

dim cell

I have now renamed this variable and no reformats have occurred since. I expect and hope that this has resolved the issue. Many thanks for help!

HKK