一旦你有關於數據源的信息(如服務器/數據庫名稱,證書等),你只需要VBA的模塊中的幾行,像這樣:
Dim theVariableForDataFieldYouWant as Integer
Dim db as database
Dim rs as recordset
Set db = YourDataConnectionStringHere
Dim sql as string
sql = "Select aFieldYouWant, anotherFieldYouWant from yourTableName WHERE someField = yourCriteria"
set rs = db.openRecordSet(sql)
if rs.eof then
' you recordset is empty, nothing matched
else
theVariableForDataFieldYouWant = rs.fields("theDataField")
end if
rs.close
db.close
set rs = nothing
set db = nothing
如果你提供更多的細節,我可以更精確,但基本上這是總結。將代碼放入函數或子代碼中,然後在選定的事件上調用它。
請提供更多的技術信息,如屏幕,代碼,數據等...... – Valijon
您是如何將這個外部數據*轉換爲* visio的? – blckbird