determine if ANY workbook is open before closing down - Excel Help & Excel Macro Help
SEARCH ENTIRE SITE LOADING..

OZGRID Excel Help & Excel Best Practices Forums

Information Helpful? Why Not Donate.

SPECIALS PAGE FOR BARGAINS | BUILD YOUR GOLF SWING | FREE CUSTOM FUNCTIONS ADD-IN


Download Active Data For Excel Demo


Go Back Excel Help & Excel Macro Help > HELP FORUMS > EXCEL HELP
HOME Register Forum Help Calendar Search For Today's Posts Mark Forums Read

Reply

determine if ANY workbook is open before closing down

ANSWERS TO SIMILAR QUESTIONS
Function/Formula To Determine If Workbook OpenDetermine If Shared Workbook OpenDetermine If Workbook OpenClosing Workbook When Closing Userform



Javascript DHTML Drop Down Menu Powered by dhtml-menu-builder.com

Create Excel dashboards quickly with Plug-N-Play reports.


 
Thread Tools Search this Thread
Old April 20th, 2005
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
DANDERSON DANDERSON is offline
Member
 
I'm a Spammer:
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Average
Join Date: 3rd August 2004
English is 1st Language:
Posts: 56 -- Threads: 18
determine if ANY workbook is open before closing down

Basically, I have written a VBA app that calls upon Excel, and opens Excel, then opens a workbook, and then makes a few modifications, and then saves and closes that workbook.

What I cant seem to figure out is how to determine if the user has any other workbooks open before the VBA app attempts to shut down Excel.

I have found example for a specific workbook, but I will not know what workbook a user night have open. I just want a check tool.

Thanks for the guidance,
Dan
Print [Post / Thread] Reply With Quote
Old April 20th, 2005
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
Neiluk66 Neiluk66 is offline
Senior Member
 
I'm a Spammer:
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Just Above Average (Can Record Macros & Know Most of Excel)
Join Date: 12th January 2005
English is 1st Language:
Location: Dusseldorf
Posts: 232 -- Threads: 54
Re: determine if ANY workbook is open before closing down

Hi,

I'm no expert but i can start you off.

If you count the number of open workbooks first then build an If function around the numer returned you can say: if there are more than 1 workbooks open then, do something, otherwise close and save changes.

Thefollowing works but i dont fully understand why itis telling me i have two open when i only have 1 open so i set the value to 2 to show that the logic works.

Might be my personal macro wk who knows



VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
Sub WORKBOOKS() nowbs = Application.WORKBOOKS.Count If nowbs < 2 Then Application.WORKBOOKS.Close Else End If MsgBox nowbs End Sub
Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.
File Type: xls Book5.xls (17.5 KB, 28 views)
Print [Post / Thread] Reply With Quote
Old April 20th, 2005
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
DANDERSON DANDERSON is offline
Member
 
I'm a Spammer:
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Average
Join Date: 3rd August 2004
English is 1st Language:
Posts: 56 -- Threads: 18
Re: determine if ANY workbook is open before closing down

Thanks! That was the lead I needed. I was able to modify it for my needs. I greatly appreciate it, have a great day!
Dan
Print [Post / Thread] Reply With Quote
Reply Lifetime Upgrade To Ad Free Styles

   « PREVIOUS Insert new row but formulas change || Correct NUM! error NEXT »
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 23:15.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ozgrid is Not Associated With Microsoft. Ozgrid Retains the Rights to ALL Posts and Threads