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 SheehySystem Security ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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

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 SheehySystem Security ManagerAuthor 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
[ fanpages ]IT Services ConsultantCommented:
No problem at all.

Hope the rest of your project is as easy to resolve! :)
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

John SheehySystem Security ManagerAuthor 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
[ 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 ]
John SheehySystem Security ManagerAuthor Commented:
That is exactly what I was looking for.  You just literally saved me a day to two days worth of work.  Thank you
[ fanpages ]IT Services ConsultantCommented:
You're very welcome.
John SheehySystem Security ManagerAuthor 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
John SheehySystem Security ManagerAuthor Commented:
Posted the new question out there
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.