开发者

Excel/VBA Connecting to Oracle Database

开发者 https://www.devze.com 2023-02-01 16:57 出处:网络
I am writing an Excel 2007 macro in VBA that queries an Oracle database based on some user input. When I record a macro of the query, the macro uses ListObjects.Add. But I know there is also the Query

I am writing an Excel 2007 macro in VBA that queries an Oracle database based on some user input. When I record a macro of the query, the macro uses ListObjects.Add. But I know there is also the QueryTables object, among other things. I am looking for an object that will make the hand-coding easiest, i.e. the code will be clean and concise, and make sense. Furthermore, I can't simply record a macro, because the query is variable - it is dependent on user input.

What is the best object (ListObjects, QueryTables, etc.) from the Excel Object Model Reference (in the MSDN Library) to use for this pur开发者_如何学编程pose? More generally, what is the best way to go about it?

Thanks in advance.


I have gone ahead with QueryTables, which is documented in the MSDN Library under Excel Model Object Reference. It is clean, simple, and direct.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号