By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 2,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

How to hide excel close button programatically

P: n/a
Hello all,
I have to open a readonly Excel sheet from clicking on a button on an access
form. So far no problem:
Dim ObjXL As Excel.Application
Dim ObjXLBook As Excel.Workbook
Dim ObjXLSheet As Excel.Worksheet
Set ObjXL = CreateObject("Excel.Application")
Set ObjXLBook = ObjXL.Workbooks.Open("Mypath\Myfile.xls", , True)
Set ObjXLSheet = ObjXLBook.Worksheets("Main")
ObjXL.Visible = True

Then the user puts in the data. However, I want to prevent him from giving
it the wrong name and save it in the wrong place.
So I want to hide the close button on the sheet and insert a custom button
which gives the file the right name and saves it at the right place (path).
So my questions are ... How do I hide the close button when opening the file
(if at all possible) and what is the correct code to put on the onclick
event of the custom button to give it the right name and right place ?
Any help very much appreciated.
Ronny
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can't hide the close button. If you have control over the origination of
MyFile.xls, then you could add code to it that would prevent anyone from
closing the workbook unless they used your special button.

If you DON'T have control over the origination of MyFile, then I have two
options for you, since you seem to KNOW what to name the file and where to put
it BEFORE they even open the file:

1) Before opening it, copy it to the new name/location, and make it editable

2) After the user gets back to Access, test for the name/path (using DIR
function), and pop up an appropriate guilt message as needed.
Nov 12 '05 #2

P: n/a
Thank you, this sure helps
Ronny
"DCM Fan" <dc****@aol.comSPNOAM> schreef in bericht
news:20***************************@mb-m01.aol.com...
You can't hide the close button. If you have control over the origination of MyFile.xls, then you could add code to it that would prevent anyone from
closing the workbook unless they used your special button.

If you DON'T have control over the origination of MyFile, then I have two
options for you, since you seem to KNOW what to name the file and where to put it BEFORE they even open the file:

1) Before opening it, copy it to the new name/location, and make it editable
2) After the user gets back to Access, test for the name/path (using DIR
function), and pop up an appropriate guilt message as needed.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.