Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 Excel 中查找特定数据并将相关信息复制到 word 字段中。
1) 密钥存储在 Word 字段之一中(比如“primaryID”)。
2)Excel中有一个primaryID列
我在 Word 中使用 Excel 对象库引用。有没有办法“VLOOKUP”Excel中的数据并将其复制到Word?有没有其他选择?
你试过 range 对象的 find 方法吗?根据 MS VBA 帮助,它“返回一个 Range 对象,该对象表示找到 [the] 信息的第一个单元格”。
要使用 VBA 获取行号,假设 id 是唯一的:
workbook.WorkSheets(sheetName).Columns(primaryID_Column).Find(ID_to_find).Row