Skip to main content
17-Peridot
September 14, 2011
Solved

Read in Excel sheet tags via visual basic

  • September 14, 2011
  • 12 replies
  • 7842 views

Hi all,

is it possible to read in the tags of the sheets in an excel work sheet? I'd like to populate a list box with the tags so that I can choose by clicking which sheet I wish to read in.

Has anybody some VB code that might be useful?

Thanks in advance

Raiko

Best answer by MikeArmstrong

Which script are you getting the error with? Push button or list box?

Mike

12 replies

1-Visitor
September 14, 2011

Do you mean the name of the worksheet within Excel?

Mike

Raiko17-PeridotAuthor
17-Peridot
September 14, 2011

Hello Mike

yes. The several sheets within one Excel file (i.e. tabs) are labelled sheet 1 to... Quite often I get Excel files with measurement data where these names have been altered (e.g. temp. reading 11...) so that I need to open the excel file in order to get the tab names. Any automation process on this task would help.

Cheers

Raiko

Knew that you'd answer first 😉

1-Visitor
September 14, 2011

This sort of works, have a look.

I cannot find the code to do it fully automated, but this is a work around. I have used the function below within the excel worksheet to extract the tab name, and then called into Mathcad. It would mean whoever creates the Excel file doing a little extra work.

Have a look at both of the attached and let me know what you think.

Mike