ms access - Read Excel file sheet names -


i have export process transfers data access tables excel file. couple times have had issues process didn't generate 1 or more of sheets (1 sheet = 1 table) in excel. when transfers complete want access check if sheets located in excel file. have of check process worked out need way "read" sheet names excel file in table. how can read sheet name (not data)?

from access can automate excel, open workbook file, , read sheet names worksheets collection.

this sample uses late binding. if prefer binding, add reference microsoft excel [version] object library , enable "early" lines instead of "late" lines.

give procedure full path workbook file pworkbook parameter.

public sub list_worksheets(byval pworkbook string)     'dim objexc excel.application '     'dim objwbk excel.workbook '     'dim objwsh excel.worksheet '     dim objexc object ' late     dim objwbk object ' late     dim objwsh object ' late      'set objexc = new excel.application '     set objexc = createobject("excel.application") ' late     set objwbk = objexc.workbooks.open(pworkbook)     each objwsh in objwbk.worksheets         debug.print objwsh.name     next     set objwsh = nothing     objwbk.close     set objwbk = nothing     objexc.quit     set objexc = nothing end sub 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -