auto close workbook

what code would i have to put in VBA (data) to close the data workbook when i 
close the (test) workbook or visa versa
0
Utf
12/6/2009 4:43:01 PM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
1376 Views

Similar Articles

[PageSpeed] 14

Check the Event-Macro: Workbook_BeforeClose
Micky


"swain.s@blueyonder.co uk" wrote:

> what code would i have to put in VBA (data) to close the data workbook when i 
> close the (test) workbook or visa versa
0
Utf
12/6/2009 4:56:01 PM
To be more precise - use the hereunder code in the TEST WB:
====================================
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Workbooks("DATA.XLS").Close SaveChanges:=False
End Sub
==========
Micky


"מיכאל (מיקי) אבידן" wrote:

> Check the Event-Macro: Workbook_BeforeClose
> Micky
> 
> 
> "swain.s@blueyonder.co uk" wrote:
> 
> > what code would i have to put in VBA (data) to close the data workbook when i 
> > close the (test) workbook or visa versa
0
Utf
12/6/2009 9:02:01 PM
i get

run-time error '9':

suscript out of range

"מיכאל (מיקי) אבידן" wrote:

> To be more precise - use the hereunder code in the TEST WB:
> ====================================
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
>     Workbooks("DATA.XLS").Close SaveChanges:=False
> End Sub
> ==========
> Micky
> 
> 
> "מיכאל (מיקי) אבידן" wrote:
> 
> > Check the Event-Macro: Workbook_BeforeClose
> > Micky
> > 
> > 
> > "swain.s@blueyonder.co uk" wrote:
> > 
> > > what code would i have to put in VBA (data) to close the data workbook when i 
> > > close the (test) workbook or visa versa
0
Utf
12/7/2009 3:39:02 PM
Reply:

Similar Artilces:

Auto Filter problem
I am using the auto filter for a particular column to sort out differen medical programs. When I click the drop down and click a program, i doesnt show me ALL the lines that say this particular program. Why is this? -- Message posted from http://www.ExcelForum.com Hi maybe some hidden characters in these lines 8e.g. additional space characters, etc.) -- Regards Frank Kabel Frankfurt, Germany "jkb724 >" <<jkb724.19rasx@excelforum-nospam.com> schrieb im Newsbeitrag news:jkb724.19rasx@excelforum-nospam.com... > I am using the auto filter for a particular column to so...

Auto-Editing
Word 2003 has a very annoying default. It assumes too much! If I reformat a few words in a document, it changes the entire document to that formatting. Grr-rrr-r! I have to constantly press undo to get what I want. I know there's a feature that's causing this annoyance but I can't find it to turn it off! Can anyone help, please? See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "Connie Martin" <ConnieMartin@discussions.microsoft.com> wrote in message news:CD959D82-F81B-4A9D-993E-73...

Why do the tabs disappear (workbook has multiple sheets)
Sometimes when I am viewing my workbook, the tabs are gone. If I got into "Full Page" view, they are there - but I don't want to work in the workbook when it is in full page view. Mel - sometimes the horizontal scroll bar at the bottom of the window 'hides' the tabs. If you have a long scroll bar, look for a small vertical bar just to the left of the < arrow in the scroll bar. Drag that to the right to see the tabs. I imaging there are other things people have come across... -- Daryl S "Mel" wrote: > Sometimes when I am ...

Update of account glitch on closed accounts
I get the following error message when updating my accounts at a bank. I have several accounts and the others get properly updated. "Microsoft Money could not update your account because you bank or brokerage does not have a record of it. The account may be closed or the account number may have change. Learn more." It is true that the account that cannot be updated is a closed account there at the bank. So, my question is...How can i tell MS money to stop asking the bank for this account's information? I have only been able to figure out how to tell MS Money to query ...

Auto-Calculate
I have a spreadsheet that utilize the stock quote add-in from MSN. On a daily basis I refresh the add-in functions for the Highs, Lows, Last, Volume, etc. On occasion the spreadsheet reverts to manual caculation settings, and I have to press the F9 even after I updated the quotes. I've always preferred the any spreadsheets I open, blank or otherwise, the automatic setting selected for calculations. I consider this an annoyance. Has anyone experienced this glitch? Is there a fix for it? Ron_D Ron Excel takes the calculation mode from the first workbook that opens in a session. Sub...

auto copy self
How do I arrange for Outlook to automatically copy myself on every new, reply or forward email? If you mean keep a copy of all sent, see settings under Tools/Options/Email Options and Advanced Options David "rich" <steamuk@aol.com> wrote in message news:055c01c3664f$dadecd30$a001280a@phx.gbl... > How do I arrange for Outlook to automatically copy myself > on every new, reply or forward email? ...

Auto Scale Chart Macro -- Any improvements please?
This is the best way I've found to correctly scale a chart -- the only way I found to exclude a chart interpolating with #NA cells was to delete those cells containing #NA, and run the chart. This takes a long time on my computer. Wondering if there is a better way. This macro is directly taken from 2 excel mvps and modified; i believe a mehta and ron bovarty, but could be wrong. Thanks for taking a look. Sub AutoScaleYAxes() Dim ValuesArray(), SeriesValues As Variant Dim Ctr As Integer, TotCtr As Integer Application.Run "Extend_Stock_Data" Applic...

Auto correct or Auto complete
We are all familiar witht he auto correct or auto complete functions found in MS applications. Of course that means it is available in Access also. My question is this ... can this function be replicated within the DB, so that the set of auto correct items are part of the package rather than something that would have to be set up on each individual desktop system? It's use, for me, would primarily be within a memo field where medical abreviations, used as a shortcut, would convert to the true meaning as the user types them in. Ex: "prn" without quotes would change to. &qu...

Extracting data from workbooks. Help.
hello I have a situation where there are several workbooks, of variable name, contained within a folder on my hard drive. I have a master workbook in a folder higher up the same directory tree that I want to use to gather information from the other workbooks of variable names. The cell, A1, that I am interested in is on sheet "OnCall" in each of the workbooks of variable name. Is there any way that I can open the master workbook and then automatically extract the data from cell A1 in each of the other variable name workbooks? I hope that as clearer than mud? hopefully Tom Here&...

OWA auto login
I am trying to use the credentials from the forms authentication login to automaticaly log in to Outlook Web. I redirect to a URL with this format: http://UserName:Password@mailserver/exchange I have seen this example in other posts but this does not work for me. I still get the Outlook Windows Login prompt. Perry Perecli Manole wrote: > I am trying to use the credentials from the forms authentication > login to automaticaly log in to Outlook Web. I redirect to a URL with > this format: http://UserName:Password@mailserver/exchange > I have seen this example in other posts but t...

Auto look through subfolders
Please help. I can write a macro that will extract data from all excel files in a specific folder. What I need to be able to do is write a macro that will automatically extract data from excel files within folders and sub folders and sub sub folders etc For example the data is all held on the following directory: H:\development forms\2006 cost sheets\ And within that directory by customer - for example Tesco, Boots, Asda etc. These customers are then subdivided into product ranges - eg 1,2,3,4 etc and some futher subdivided by national or exclusive. All the excel files are in exactly th...

Any way to get rid of an auto-suggestion in the login dialog box, for Exchange/OL using RPC over HTTP?
A client was using RPC over HTTP to two different Exchange servers (OL prompting for profile on startup). Both profiles were set up to prompt for credentials upon connection to Exchange. There's now only one Outlook profile needed; the other is gone and OL isn't prompting for the profile selection any longer, which is fine. However, Outlook is remembering domain1\user and domain2\user in the login dialog box, and I'd love to be able to get rid of the no-longer-valid credential dropdown suggestion. (The computer is not a member of a domain and hence always needs to be prom...

An auto reply to an auto reply!
Had the funniest situation yesterday. Somebody emailed a public folder we have set up. On there we have a rule to send a reply saying thanks for your email -someone will be with you shortly (we have to have this message on - it is for some website that recently went live). Now that auto reply went back to the guy who emailed - who must have sent it from a public folder himself (as he forwarded the original email from a public folder). The guy received our auto reply - and promptly his email system sent an auto reply to us. As is the way it is set up - our email system sent him an auto ...

2 workbooks open
Hi - A co-worker created a spreadsheet - over the course of a few weeks, several tabs were added. Recently, when I received the spreadsheet via email, 2 identical workbooks opened. The 1st workbook was called 'Data (1)' and the 2nd was called 'Data (2)'. There wasn't a macro on either spreadsheet - I'm at a loss to why 2 identical workbooks opened. Any ideas or suggestions are appreciated. Regards, Close the second instance of the Workbook and then Save the file. Meg wrote: > Hi - > > A co-worker created a spreadsheet - over the cou...

Auto date
I am trying to create a field in a form that if anything is changed on it, it will automatically update the date to current date. Is this possible? Sojaminc wrote: >I am trying to create a field in a form that if anything is changed on it, it >will automatically update the date to current date. Is this possible? Make sure the last changed date/time field is in the form's record source table/query. Then use the form's BeforeUpdate event: Me.lastchanged = Now -- Marsh MVP [MS Access] Hi - You can do this in the On Dirty event of the form, which fires as soon as you m...

Auto-Alphabetize
I have a master data sheet, with columns of different information. I'd like to pull information from 3 different columns (Rank,LastName,Shift) into a separate column (I know how to do this). What I would then like to have happen is, in another separate column, have the information sorted alphabetically by last name. There are duplicate last names, in which case I'd like them sorted in rank order. Is this at all possible? Also, I can't use a VB Macro - it needs to be in a formula or array format. Rank.......LastName.........Shift PO Smith B/1 ...

How do I auto-reply incoming eMails ?
During my holidays I want to inform the sender of incoming eMails that I am currently not in office. How can I setup an auto-reply note? Do I setup this in my Outlook 2003 or in the Exchange Server? Joe If you connect to an Exchange server at work, use the Out of Office function (under tools). It will reply once to each sender that you are out of the office. By default in Exchange, auto-replies to the internet are turned off so only internal addresses would receive the Out of Office reply but verify with your Exchange Admin how they have the server configured. If you have a POP3 acc...

Auto change of Row number within Formulas
Good morning , I would much appreciate some help in creating a formula which would do the following Cell Resul A1 B1 1 A simple formula would be - sum(c(a1):c(b1)), where the result in this case would be the sum of cells c5:c10. Many thanks, Gle Hi Glen, Look at the INDIRECT() function in HELP -- Kind Regards, Niek Otten Microsoft MVP - Excel "millarg" <anonymous@discussions.microsoft.com> wrote in message news:02302493-2C51-4CB9-9463-06523884BBD6@microsoft.com... > Good morning , I would much appreciate some help in creating a formula which would do ...

Auto-Capitalize
How do I turn this off. I'm making a basic flowchart. I need to turn this off. Thank You On Tue, 24 Feb 2009 10:42:05 -0800, eyewirejets <eyewirejets@discussions.microsoft.com> wrote: >How do I turn this off. I'm making a basic flowchart. >I need to turn this off. menu Tools -> Auto Correct Options -- Regards, Paul Herber, Sandrila Ltd. Electronics Packages for Visio http://www.electronics-packages.sandrila.co.uk/ ...

Force XmlSerializer to use explicit closing tags for zero-length strings?
Greetings, I am using the .Net Framework XmlSerializer to serialize a class that contains some string properties. The problem is that when a string contains a zero-length string ("") it is serialized as: <foo /> When what I would really like is: <foo></foo> Now I know the former is well-formed and all, but I really need the explicit closing tag. The XML file will be read by another system (out of my control) that requires the explicit closing tag. Any ideas here? Thank you. Regards, Scott Ballard <scott.ballard@gmail.com> wrote in message news:111...

auto delete attachment
How I can write a rule or script that will automatically delete any email that has the attatchment name? I'm using windows xp and outlook 2003. Norton AntiVirus Deleted1.txt Thanks, Aaron Rules don't touch attachment names so your only other choice is writing a program to do this. Try posting in an Outlook programming forum - also see http://www.slipstick.com and http://www.outlookcode.com for some assistance. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After searching google.groups.com and finding no answer: Aaron <kuy...

XP and Outlook 2003
XP (SP2) users receive new email notifications (and can reply to the email) even after closing Outlook 2003. Task manager shows that Outlook is still running despite having closed the application. Yet.....when windows 2000 PCs running the same version of Outlook close Outlook, it closes completely and users do not receive new email notifications until they re-open Outlook. Why?? (Both XP and Windows 2000 users are all running in cached mode.) Thank you, Lorri Moore LMoore <LMoore@discussions.microsoft.com> wrote: > XP (SP2) users receive new email notifications (and can...

Outlook
My auot archiving is turned on and set to auto archive every 7 days. There are certain folders that do not auto archive even though all folder are set to use the default setting of 7 day. I'm not sure why some folders are not auto archiving. Please help. Archiving works on the modified date of the items, not the received or sent date. If you have accessed the item in the last 7 days, the modified date will be the date you last accessed the item and fall outside of your 7 days or older parameter. Try this - add the modified date to your folder and then sort by that date. You can see...

Auto fit contents
Auto fit (Row Height) works for a single column. It does not appear to work for merged culumns. Can auto fit row height be made to function for contents in merged columns ? -- Mucho Gusto Not without using VBA.. If interested see google search thread for code by Greg Wilson. Watch out for word wrap in the URL which is all one line. http://groups.google.com/group/microsoft.public.excel.misc/browse_frm/thread/2293ac4e6373c4d3/ca1c160cbeb27874?lnk=st&q=&rnum=4#ca1c160cbeb27874 Gord Dibben MS Excel MVP On Wed, 27 Jan 2010 07:05:01 -0800, Una Pregunta <UnaPre...

Rogue Archive File (Can't close/remove)
I had created a new .pst file through Outlook (File/New/Outlook Data File) but then decided I didn't need it and deleted through Explorer. I noticed the pst file I had just removed was still "open" in Outlook so I tried to close it and get a message that says "The operation failed. An object could not be found". I have tried re-creating the pst file, renaming, looking through the registry... I'm at wits end! How do I get this ghost "Archive Folders" entry out of my "All Mail Folders"? I am using Outlook 2003 under Windows XP. ...