Automatically Close Workbook If Another Opened

Oct 29, 2006

I have a workbook that automatically saves itself when it is closed without prompting the user. Now I need to make the workbook automatically close if another workbook is opened.

if my_workbook.xls is opened and you open another workbook, I need my_workbook.xls to close instantly.

View 7 Replies


VB Code To Close Workbook Opened After Certain Date

Jan 17, 2013

I have a workbook which should only be used between certain dates

In this example between 3rd March 2013 and the 1st March 2014

Would it be possible that if the user opens the workbook outside of this date range an error message could appear then the workbook would then close ?

View 6 Replies View Related

How To Automatically Run VBA Code When Workbook Is Opened

Aug 10, 2010

How do I automatically run VBA code when a workbook is opened?

View 7 Replies View Related

Automatically Close Workbook Between Times

Dec 20, 2006

I am trying to have a workbook automatically close if it is not between 8:00PM and 9:00 PM on the user's computer.

View 9 Replies View Related

Automatically Close Workbook If Macros Are Disabled

Apr 16, 2008

If a user disables macros when opening a file, is there a way to have the excel file automatically close?

View 9 Replies View Related

Close An Unused Workbook Automatically After A Specific Time

Apr 19, 2007

I have got a spreadsheet which is being used as a database. I would like the spreadsheet to close automatically if the user has not "touched" it for a specific amount of time (say 1hr).

2 scenarios:

a/ The user is working in Excel but with another workbook.
b/ The user has the excel spreadsheet open but is working with another application, say Word

I experimented with Workbook_WindowDeactivate but I do not know how to stop the process if the Workbook is reactivated (Maybe a DO ...LOOP calling a function returning a True/False statement on the event Workbook_WindowActivate !!). My way of thinking is the following

Workbook is deactivated
Start a timer
If the workbook is not reactivated with 1hr, save and close (no user intervention wanted)
Else stop timer
Repeat process

View 9 Replies View Related

Close Down Webpage Opened Via Hyperlink?

Jun 19, 2013

I have a list of hyperlinks.

I want to open each one, grab the web address, close page, move onto next link.

I am stuck on the closing part.

This is what I have so far.

Dim rng As Range
Dim LastRow As Long
Dim cl


View 8 Replies View Related

How To Close Text File That Was Opened By DLL Called By Excel

Mar 11, 2014

I call it from a macro. It is supposed to write some temporary files, and close them in the end, and delete them. Sometimes, the dll can't close properly, and the text files remain open.

With error treatment in my macro, I can continue execution, but i need to delete that files.

Since the dll DOES NOT CLOSE the files, i'm not able to delete them in my macro.

I need some way to close that files, in order to delete them.

When I use GetFile to reference the file, it remains as "File", which does not accept "Close" method. I can reference the file with myfile.OpenAsTextStream, but this way it seems to me that the file is opened again, and the "Close" method does not work either, with the file defined as a TextStream object.

If I close excel, I'm able to delete those files, but that's not the way I want. Since IT'S OPEN IN EXCEL PROCESS, I imagine there's some way to close it.

View 1 Replies View Related

Compile Error On Close Of Excel 2003 But Not On Close Of Workbook

Mar 22, 2012

I am using Excel 2003.

It’s been working perfectly up until around an hour ago. However, now when I close Excel, I get compile errors.

These compile errors seem to be because Excel is trying to access controls in the workbook after it has closed. Since the workbook is closed, VBA can no longer ‘see’ the controls, and therefore it thows up errors.

I’m also getting a similar error on a Worksheets("DataExplorer").unprotect line, which seems to be because the worksheet isn’t there after closing.

These errors only occur when I close the whole excel application using the big cross in the top right. If I just close the workbook (using the smaller cross just below the big cross in the top right of excel), it doesn’t throw up these errors.

Just to clarify: all of the code runs perfectly when Excel is open. The errors are being thrown up for lines of code which run without problem until Excel is closed.

View 9 Replies View Related

Copy A Range Of Cells In Another Workbook Opened In A Separate Instance Of Workbook

Feb 11, 2010

I m not able to use the standard Excel Paste Special function when I copied a range of cells in another Excel workbook opened in a separate instance of Excel. Instead, Paste Special thinks that I have copied some non-Excel objects and gave me the Paste As options. This is not the case if I open both workbook within the same instance of Excel. Could you share with us if there is a trick to trigger the normal Paste Special options in such situations (without having to invoke Macro procedures)?

View 2 Replies View Related

Copying Data From Recently Opened Workbook To Workbook Where Form Is Present

Jun 16, 2014

All i did was i just created a form to open a workbook from the directories.

Code to copy the data from that recently opened workbook to my workbook where I have my forms. I need to copy that data as in the case that i don't know the workbook and the sheet name i'am going to open as i may open any of the files!!

View 2 Replies View Related

CountIf - Automatically Update Once Opened

Oct 18, 2008

I have made a league table which pulls data from another table - in this example. The actual one i am using pulls data from a different workbook. Any way...In one of my columns i am using the countif formula to count how may times an advisor's name appears. Eg - =COUNTIF(A:A,"Sally A").

Is there another formula i can use to carry out this function. The reason i am asking this is there are multiple links in my league table to the other workbook. Once i open my league table all the data is updated - as the other workbook data is changed. However, for this to work i need to open up the other workbook where the data is , otherwise i will get the VALUE# error. I do not want to open the other workbook just to pull the data over, i need this league to automatically update once opened.

View 3 Replies View Related

Copy Worksheet From Closed Workbook To Current Opened Workbook

Aug 21, 2014

I have an open workbook (A) and this is where the code should reside. I want to use VBA to copy the content of an entire worksheet from a closed workbook (B) to an existing worksheet in workbook A. How would you accomplish this?

View 7 Replies View Related

Automatically Prompt To Save Template When Opened

Jun 4, 2008

Is it possible to open a template, prompt the user to enter data and have the template save itself as the user defined data?

View 5 Replies View Related

Automatic Open Others Workbook When We Opened The Master Workbook

Aug 26, 2009

How to Automatic open others Workbook when we opened the Master Workbook.
Examp.: I have a workbook (Master.xls), and when this file be opened, and then others workbook (Transactions.xls, Order.xls, etc.) is opened too.

View 5 Replies View Related

Making Workbook Opened From Other Workbook Active

Nov 20, 2006

I have a workbook that is a formatted report that I need to insert data from a name variable "CSV" file. I have created a macro in this workbook that calls an "Open" dialog for CSV files that I can use to browse to and open the source file. The macro then is supposed to "select all" copy and close the workbook then make the original workbook active and paste the data starting at row 2. The macro "seems" to be working perfectly except when I do the open the macro then makes the original workbook active, selects all copies then wants to close the original workbook. How can I tell the macro that the csv file that I just opened should be the active workbook, baring in mind that the name won't be known before the time it's opened so I can't hardcode the "active. workbook (NAME) "route.

View 9 Replies View Related

Run Macro Once Workbook Is Opened

Oct 2, 2012

I want my macro on the IR Tracker sheet to run once workbook is opened. Is this possible?

I have attached the workbook for better understanding.

View 9 Replies View Related

Set Reference To NOT OPENED Workbook

Dec 18, 2008

I've started this thread a few weeks ago but didn't get any answers on how to solve the problem or if it was even possible to solve. I would like to know if is possible to set a reference to a NOT OPENED workbook. All the code I've tried so far didn't get me anywhere:

View 3 Replies View Related

Zoom To 120 When Any Workbook Is Opened?

May 13, 2014

I am looking for a way to have Excel zoom to 120% whenever any workbook is opened. (My boss has poor eye sight...)

I set up a simple Macro

Sub Auto_Open()
ActiveWindow.Zoom = 120
End Sub

but I get an error that says "Run-time error '91': Object Variable or With block variable not set.

View 1 Replies View Related

Determine How Workbook Was Opened

Sep 8, 2006

Is it possible to write code that can identify how a workbook has been opened i.e. has the workbook been opened by another workbook or has it received a double click event on the workbook itself.

If it is possible I would like to place the code in the open event of the workbook that is being opened.

View 5 Replies View Related

Run Macro In Opened Workbook

Oct 31, 2006

An external program opens and closes Excel Workbook (OLE). What is the VBA code so when the WB is opened, Macro1 will run before OLE closes that Workbook?

View 6 Replies View Related

Loop Until The Workbook Is Opened

Jan 4, 2008

i'm tyring to formulate a do loop that will basially loop until the workbook is opened. here is my code...

Dim myBook As Workbook

On Error Resume Next
Set myBook = Application.Workbooks(vCriteria & "ISPR.XLS")
On Error Goto 0

what i want is for it to loop until myBook is <> nothing... but i'm not sure how to do that.

View 5 Replies View Related

Return To Certain Tab Each Time Workbook Is Opened

Nov 10, 2009

I have an excel file on a share site which is accessed by several people. The first tab is set up as a home page which directs the person to the relevent part of the work book that they need. My problem is that as the person saves their updates it also saves the location of the workbook they were in. I want it to return to the " homepage" automatically each time it is opened.

View 5 Replies View Related

Listbox Freezes When Workbook Is Opened

Apr 30, 2014

I have a little issue with a list-box. When i open my workbook and i click on the List Box the list box freezes, excel doesn't let me select it until i go to design mode, select the list box then close out of design mode. This sort of "fixes" the issue but i would rather not do so this way.

View 2 Replies View Related

Security Warning When Workbook Opened

May 30, 2009

my workbook is finally working the way it should but every time i open it i get a security warning window with the options disable macros, enable macros and more info. how do i get this to not show up every time it's opened. this workbook will be used by someone other than me and i don't want them to need to do anything but open it and use it.

View 8 Replies View Related

Cells Dependent Upon How Workbook Is Opened

Jun 9, 2009

I have a workbook with about 30 tabs in it. It is currently protected by a password. The workbook itself has a couple of 1000 formulas across the tabs.

What I would like to do is to lock certain cells on each worksheet depending upon if the workbook is opened as "read only" or "in edit mode" (when someone uses the password).

So when someone uses the correct password, I would still like certain cells to be locked, or after the initial password is entered for editing, another popup box with "would you like to edit cell formulas? Y/N (only on selective cells), if no, then no editing on those cells allowed, if yes, then prompted to input another password to do this.

View 14 Replies View Related

VBA To Count How Many Time A Workbook Is Opened

Oct 27, 2010

Just wanted to ask all the VBA gurus if they would know how to put the number of times (i.e. in Sheet 1, Range A1) a Workbook is opened.

I then want to basically have the code delete every sheet if ithe count is > 50.

View 7 Replies View Related

Jump To Date When Workbook Opened?

Jan 24, 2013

Is there a way that when the workbook is opened, it automatically jumps to the sheet that has today's date on it and highlights that cell.

I have 12 sheets, one for each month and labeled as such. The dates for each month in cells D5:AH5 on each sheet.

View 6 Replies View Related

Update Cell When Workbook Opened

Dec 18, 2008

How can I ensure that a cell (A1) is defaulted to the current date each time the file (in which the cell resides) is opened.

A1 is a field of a form in which the user can enter a date. I would like it to default to the current date each time the file is opened.

View 9 Replies View Related

Workbook To Check It Filename Once Opened

Dec 29, 2009

I am trying to ensure that m work book keeps the same name even when I email it to others.

I have been told on this forum that it is possible for a workbook to check its own name once opened?

I have two different names that this file can be called 1st is the one that is in use all the time and the 2nd is a archive version where the name changes each month.

The file name I wish to keep the same for the no archived version is Toolbox and a predetermined number I have a workings sheet called workings and in a cell i have a formula =TEXT("Toolbox Application " & Cover!E10,) this will give me the file name that i need to check for example it could be Toolbox Application 00089 or Toolbox Application 00967.

I also have a cmd that archives the workbook and saves it as Toolbox and the Month it was for Toolbox for Jan for example

I also need this to open if it is an archive

if neither of the names match i need the workbook to close and a msgbox to tell user to rename the workbook correctly.

View 9 Replies View Related

Copyrights 2005-15, All rights reserved