Open file with custom button

A

Andy

I have created a custom button but need to write the macro to open a specific
file. I guess that this macro needs to be written to my profile/harddrive and
not within the actual file?

Also I cannot change the button, when I right-click, it just brings up the
normal list of toolbars to select/deselect.

Any help/guidance appreciated.
Cheers
 
C

Chip Pearson

I guess that this macro needs to be written to my profile/harddrive

I'm not sure what you mean by that. To open a specific file, just use

Workbooks.Open "C:\Path\FileName.xls"

If you need to get your user profile directory, use

Workbooks.Open Environ("Userprofile") & "\SubFolder\Filename.xls"

or for a more robust solution, get the path to any of the user profile
directories using the code at
http://www.cpearson.com/excel/SpecialFolders.aspx .

Excel supports two sets of controls: those on the Forms toolbar and
those on the Controls toolbar. Which are you using?

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top