Word 2010 Macro Question

How do I make this code generic for all users in my office?

Application.Templates( _
        "C:\Users\chayden\AppData\Roaming\Microsoft\Document Building Blocks\1033\14\Built-In Building Blocks.dotx" _
        ).BuildingBlockEntries("Grid").Insert Where:=Selection.Range, RichText:= _

I would hate to have to replace "C:\Users\chayden" for all of my users.

thanks!
LVL 1
cchaydenAsked:
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.

ItpotterCommented:
Use application(exe) relative path

System.Windows.Forms.Application.StartupPath
or
string currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
0
cchaydenAuthor Commented:
Well I have messed with this a little while and didn't get it. I am wondering if you could type out the line for me please. (I just cut and paste the original line from the record macro code so I don't really know all that much about VBA)

Thanks!
0
cchaydenAuthor Commented:
I guess I should close this.

I finally ended up with this working code.

Application.Templates( _
        Environ("APPDATA") & "\Microsoft\Document Building Blocks\1033\14\Built-In Building Blocks.dotx" _
        ).BuildingBlockEntries("Grid").Insert Where:=Selection.Range, _
        RichText:=True
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
cchaydenAuthor Commented:
=)
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 Word

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.