Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel sheet as varible

Status
Not open for further replies.

moremail

Technical User
Aug 23, 2011
10
US
I have a program that theoretically should select a chosen excel sheet from a workbook to import into a table.

I have no problem creating a table from which to choose the tab. The data looks exactly like this including the quotes;

'ABC Homes$'

After selected it is passed to a varible with this;

store customer to mcust

When I try to select the sheet with this;

.Application.Worksheets(mcust).Activate && Select sheet

OEL Error code 0x8002000b: Invalid index

Any ideas how to make this work? I found if I store a number value in the variable I receive no error however I have found no way to coorelate the sheet numbers with sheet names. I appreciate it. Thanks.
 
Olaf - What is so unusal about adding ()

I did not say that it was 'unusual'.
I said that I have never seen it done that way.

In the variety of resources and examples that I have used over the years while working on my own VFP Automation of Excel efforts, I have never seen it done that way.
I am sure there are probably numerous examples out there, but I didn't come across any during my own investigations.
And what I did find, worked for me.

Consequently its appearance in the code above seemed to me to be questionable.

If it works, fine.

moremail - I am glad that you have gotten what you need.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top