Hi everybody.
My first post, so be nice to me!
I'm struggling with a problem with some VBA I've written. I have a list of data in a Word table column, and a similar list of data in an Excel spreadsheet row. I'm trying to cycle through the two sets of data, and do various tasks when a match is found. My Excel VBA code looks like this:
aString = objDoc.Tables(1).Cell(aCount, 2)
bString = Sheets("Stuff").Cells(2, bCount).Value
If aString = bString Then
...etc
The problem is that it never returns any matches. I've put message boxes in to check, and even when the two strings look the same, it isn't being picked up by the If...Then statement. Everything else seems to be working fine - Excel is controlling Word properly and the data is being pulled out correctly etc. I've seen similar threads on this forum where people have had issues with spaces - I'm pretty sure that's not the case here. I've tried using 'Trim' on each string, and I've also checked in cases where there are only single words in the data - same problem.
Am I missing something? Very grateful for any help. Thanks
Bookmarks