Excel/VBA Connecting to Oracle Database
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.
精彩评论