Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Macro Button and Closing Excel

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro Button and Closing Excel

Close it with something like:

Sub hfsja()
ActiveWorkbook.Saved = True
ActiveWorkbook.Close
End Sub

--
Gary''s Student - gsnu200775


"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro Button and Closing Excel

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Macro Button and Closing Excel

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Macro Button and Closing Excel

Take the macro out of LiftLogger and put it in your Personal.xls.

Set Personal.xls to hidden.

All open workbooks will have access to any macros in Personal.xls


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 10:01:01 -0700, Nils Titley
wrote:

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Macro Button and Closing Excel

Gord,

Thanks for the information. I will try it.



"Gord Dibben" wrote:

Take the macro out of LiftLogger and put it in your Personal.xls.

Set Personal.xls to hidden.

All open workbooks will have access to any macros in Personal.xls


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 10:01:01 -0700, Nils Titley
wrote:

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro Button and Closing Excel

What I meant was try something like this

Workbooks.Open(filename, ReadOnly:=True)

If you put the code in the Personal.xls file, you won't need to open the
file and you won't get the error message. If you keep it in a separate file,
you'll need something like the above. My personal.xls file is pretty large
and I've started splitting out code by specific functionality.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

Gord,

Thanks for the information. I will try it.



"Gord Dibben" wrote:

Take the macro out of LiftLogger and put it in your Personal.xls.

Set Personal.xls to hidden.

All open workbooks will have access to any macros in Personal.xls


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 10:01:01 -0700, Nils Titley
wrote:

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Macro Button and Closing Excel

Barb,

Let me ask you another question. If you are providing this macro to others
is it more likely that having them put it in the personal.xls will become a
problem?

Thanks

"Barb Reinhardt" wrote:

What I meant was try something like this

Workbooks.Open(filename, ReadOnly:=True)

If you put the code in the Personal.xls file, you won't need to open the
file and you won't get the error message. If you keep it in a separate file,
you'll need something like the above. My personal.xls file is pretty large
and I've started splitting out code by specific functionality.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

Gord,

Thanks for the information. I will try it.



"Gord Dibben" wrote:

Take the macro out of LiftLogger and put it in your Personal.xls.

Set Personal.xls to hidden.

All open workbooks will have access to any macros in Personal.xls


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 10:01:01 -0700, Nils Titley
wrote:

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Macro Button and Closing Excel

If you are going to share this macro and any other macros with other users you
would be better off to place all the macros into a module in a new workbook,
then save the workbook as an add-in.

FileSaveAsFile TypeMS Excel Add-in(*.xla)

Give the add-in to your users for them to load through their ToolsAdd-ins

Then you don't muck about with their Personal.xls workbooks.

IMO this is the best way to share macros.

Also you don't have to preface the macro name with the workbook name when
assigning to a button or menu.

i.e. mymacroname instead of Personal.xls!mymacroname

Or with UDF's =myfunction(arg) instead of =Personnal.xls!myfunction(arg)


Gord

On Sat, 22 Mar 2008 15:29:01 -0700, Nils Titley
wrote:

Barb,

Let me ask you another question. If you are providing this macro to others
is it more likely that having them put it in the personal.xls will become a
problem?

Thanks

"Barb Reinhardt" wrote:

What I meant was try something like this

Workbooks.Open(filename, ReadOnly:=True)

If you put the code in the Personal.xls file, you won't need to open the
file and you won't get the error message. If you keep it in a separate file,
you'll need something like the above. My personal.xls file is pretty large
and I've started splitting out code by specific functionality.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

Gord,

Thanks for the information. I will try it.



"Gord Dibben" wrote:

Take the macro out of LiftLogger and put it in your Personal.xls.

Set Personal.xls to hidden.

All open workbooks will have access to any macros in Personal.xls


Gord Dibben MS Excel MVP

On Sat, 22 Mar 2008 10:01:01 -0700, Nils Titley
wrote:

Barb,

No, I just have an empty Excel spreadsheet open. I do not have the Lift
Logger spreadsheet open. I have a cutomized menu button that I added to run
the Lift Logger Process macro. When I am in the new Excel spreadsheet, it
run the macro fine. Nothing is written to the Lift Logger spreadsheet but I
do write to a workbook saved.

"Barb Reinhardt" wrote:

I presume you are opening the LiftLogger workbook and not making any changes.
if so, I'd suggest you open the workbook as ReadOnly within your code.
When you close it, you won't get these messages.
--
HTH,
Barb Reinhardt



"Nils Titley" wrote:

I created a Macro Button that I placed in the standard group of buttons and I
assoicated a Macro with it. Later I started Excel with a blank workbook. I
pushed the new macro button and the macro worked. It also opened the excel
workbook (Lift Logger) where the macro is stored. When I went to close the
Lift Logger workbook, I was asked, "Do you want to save the changes you made
to 'Lift Logger.xls'?

Well I did not make any changes to Lift Logger.xls? But more importantly,
1) Is there a way to surpress the opening of the Lift Logger.xls when I run
the macro in this manner? 2) Can I surpress the close message box?

If both or one are true, how and where do I put the code. It must be in the
macro some place. Please be aware that I am displaying some msgboxs in my
macro.

Thanks for your help.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing an Excel Spreadsheet via command button [email protected] Excel Programming 1 February 15th 08 04:45 PM
Closing excel from a macro maliaf Excel Programming 4 May 2nd 06 12:33 AM
Closing excel with a macro TJexcel Excel Programming 1 December 8th 04 07:42 AM
Closing Excel from a Macro Jimmy Excel Programming 6 August 20th 04 02:25 AM
Closing Excel down with a macro? andycharger[_28_] Excel Programming 2 May 6th 04 04:18 PM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"