简体   繁体   中英

Excel VBA Importing data from Word Documents with inconsistent formattting

I am trying to obtain values and tolerances from a bunch of specification sheets (word documents). The specification sheets are all very similar but the formatting within their tables is inconsistent.

For instance, sometimes the values and tolerances for power will be listed in a certain format which Excel will import as: +2% 339 kW [3] 4 -2%

Other times, the values and tolerances for power will be listed in a different format which Excel will import as: 247±2% kW [3]5

Besides editing all of the documents to make the formatting consistent, is there any way that I can use VBA to extract the values and tolerances from a variety of different formats?

I would start first with identifying the different unique formats available. Hopefully you only have a couple of formats. And use a RegEx within VBA. You should be able to write a pattern that will match all the different format variations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM