Saving a Worksheets name

I would like to be able to save the worksheets name and use it as a bookmark in a word document.

This is what I have so far:

Dim ws As Worksheet
Dim ws1, ws2, ws3, ws4, ws5, ws6, ws7, ws8, ws9 As String

Set ws = ThisWorkbook.Sheets("CNE")
ws1 = ThisWorkbook.Sheets("CNE")

The setting part work great.  But I want ws1 to equal the worksheets name. so it can be placed in a word document like so:

.Bookmarks("SR_Title").Range.Text = ws1 & "_HRS"                                                                                                  'Bookmark 12

Any thought son how to do this?

Thanks
John
John SheehySecurity AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
Hi John,

This will set ws1 to "CNE":

ws1 = ThisWorkbook.Worksheets("CNE").Name

Open in new window


or, using the same syntax as you used:

ws1 = ThisWorkbook.Sheets("CNE").Name

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John SheehySecurity AnalystAuthor Commented:
It worked.  I am amazed sometimes of how easy I forget things.  It was right there in front of my face.

Thank you very much.

John
0
[ fanpages ]IT Services ConsultantCommented:
No problem at all.

Hope the rest of your project is as easy to resolve! :)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

John SheehySecurity AnalystAuthor Commented:
I only have a little bit left.  Just need to add in a screen that shows something is happening.  Users don't like looking down at the status bar.  So that is what I am doing now.  Once you provided the solution to the this question I was able to update all the modules with the simple find and replace.

Thanks again for the quick response.

John
0
[ fanpages ]IT Services ConsultantCommented:
:)

If you are considering a "progress bar", may I recommend looking at this previous article?

"A VBA Progress Bar for Excel and Other Microsoft Apps"

[ http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/A_1756-A-VBA-Progress-Bar-for-Excel-and-Other-Microsoft-Apps.html ]
0
John SheehySecurity AnalystAuthor Commented:
That is exactly what I was looking for.  You just literally saved me a day to two days worth of work.  Thank you
0
[ fanpages ]IT Services ConsultantCommented:
You're very welcome.
0
John SheehySecurity AnalystAuthor Commented:
The only issue I have with this is how to call it correctly.  But I will post that as a separate question here in a few seconds

John
0
John SheehySecurity AnalystAuthor Commented:
Posted the new question out there
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.