ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make Command Button visible only in .xlt? (https://www.excelbanter.com/excel-programming/298554-make-command-button-visible-only-xlt.html)

RPIJG[_23_]

Make Command Button visible only in .xlt?
 
Can I make it so that the command button is only visible when I open
workbook from an .xlt and not from a .xls

--
Message posted from http://www.ExcelForum.com


Jan Karel Pieterse

Make Command Button visible only in .xlt?
 
Hi Rpijg,

Can I make it so that the command button is only visible when I open a
workbook from an .xlt and not from a .xls?


A workbook opened from a template has an empty path property, you could
test for that:

If ActiveWorkbook.Path="" and left(Activeworkbook.name,4)<"Book" then
'Code to disable your button
Else
'Code to Enable the button
End If

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com


RPIJG[_24_]

Make Command Button visible only in .xlt?
 
Thanks Jan


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 08:16 AM.

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