'以下vba腳本實現標題闡述功能,考慮以下問題: 如何捕獲一個cell單元格的單擊事件?excel 中能否添加處理其他的windows 消息? 'unit : mcc 'fun : goto exactly position in word from excel impls by vba. 'args : bookmark string(predefined in word handed yourself or using tools) 'ref : ms word/excel object lib. 'modify : 1.open word archives in readonly way 2.get abs path using for anchor 'future : 1.search by string exactly 'author : qjwxsd 'dt : 2005-04-18~~
public sub gotoword(filename, bookmark as string) on error resume next dim a as word.application dim b as word.document
dim c as excel.application dim d as excel.workbook dim e as excel.worksheet
dim path as string
set c = getobject(, "excel.application") set d = c.activeworkbook set e = d.activesheet 'path = c.path path = d.path '取得當前功能清單的路徑,傳到word中。否則word無法取得路徑, '打開相應的tc。 set a = getobject(, "word.application") if a = null then set a = createobject("word.application") end if