ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open file with custom button (https://www.excelbanter.com/excel-programming/420174-open-file-custom-button.html)

Andy

Open file with custom button
 
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

Chip Pearson

Open file with custom button
 


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)



On Tue, 18 Nov 2008 03:54:03 -0800, Andy
wrote:

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



All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com