954,582 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

macro to make excel close

I've been trying to create a macro which closes excel without the save pop-up coming up, anyone got any ideas? I don't want it to save, this is because i don't want anyone who uses it to muck it up!

grandfilth
Newbie Poster
16 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

Why not make it read only?

Check the switches section of VBA -
I believe it's the app.close or END command

Kegtapper
Junior Poster
116 posts since Oct 2005
Reputation Points: 13
Solved Threads: 4
 

no so that it's just my program that's in view...not the cell letters and numbers and tool bars and stuff...

grandfilth
Newbie Poster
16 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

ummm that's not closing Excel. I think what you are trying to do is to create a form. With no tool bars, and limited controls for users.

If that is the case you will need a USERFORM. So that Users only see the information and cannnot modify the Rows/Colums.

Pressing ALT F11 will still take you to the VBA editor, and you should see your macro you already created.

Kegtapper
Junior Poster
116 posts since Oct 2005
Reputation Points: 13
Solved Threads: 4
 

how do you go about setting up one of these userforms? Thanks so much for this help

grandfilth
Newbie Poster
16 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

Look Into The Excel Object. You can create/Manipulate excel documents with a VB Program (even with WSH alone) by using these objects. An Example

set xapp = CreateObject("Excel.Application")
xapp.Visible = True

' Make a new Excel workbook:
set workbook = xapp.Workbooks.Add
set worksheet = workbook.Worksheets("sheet1")


Basically, It just shows you HOW to work with it in VB. If you Google VB6 Excel.Application, Google will give you a whole lot of information on it. You can also read up on the excel object straight from the horses' mouth: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrgrfexcelapplicationobjectmethods.asp

This way, you can work with the excel document (the cells, and everything) without ever having to set it's visible property to true (meaning, it stays hidden). Let me know what you come up with though.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You