Multiple file handling, updates and closing...

I have an application I inherited that's programmed in 
Excel VBA (not my idea - over 5K lines of code) that has 
an update function and a file copy function. I consider 
myself rather astute and well-versed in VBA, but am a 
little rusty - but only a little. Anyway, I have a problem 
pulling what little hair I have left out.

Update function Theory: The update function checks for a 
specifically named xls file, opens the workbook if exists, 
makes this active, copies a module to a .bas file, 
activates original workbook, closes previous workbook, 
imports module from .bas file, kills .bas file, runs code 
in module, removes module, and goes on with rest of code. 
This update function is the first thing that happens upon 
the workbook getting opened.

File Copy Theory: A value in a cell determines if current 
file is one that has been opened since being deployed to 
end-users. If not opened before, open end-user's XLS file 
(filename is known and expected to be in same path as 
current workbook). [I notice that there is no 
workbook.activate call after the it was in 
Update function] Then, two sheets are copied from the 
user's workbook to the new workbook. The users workbook is 
then renamed with an extension change to '.TMP' using 
the 'saveas' workbook function and then workbook.close 
(this close occurs BEFORE workbook running this code is 
activated). The new workbook is activated & renamed as the 
user's original workbook using workbook.saveas then the 
original filename is killed....

Problem - once everything happens as expected - there 
seems to be residual copies in memory of the user's 
original and the new file where things do not behave as 
expected - forms displaying information where there should 
be nothing, etc.

Is there a method to ensure a working file that is saved 
as a renamed file and the previous filename killed while 
the routine calling the kill is from the file being 
killed - even though the saveas renamed and activated the 
new file as the active file - sounds confusing??? (hmmm... 
perhaps opening and activating the saveas file 
explicitly?) Is there a way of ensuring memory of all 
unwanted previously opened and now closed and killed 
workbooks are purged? Curiously, I have found that double-
clicking the .TMP file will open Excel - even though there 
is no association of .TMP to Excel. If I reboot, then 
double-click on the .TMP file, Excel does not open and I 
get the expected "Open with..." dialog.

Antone else have a similar experience? Is there a simpler 
solution? (code available if requested - I wanted to keep 
this question brief at first...)



laszlo1 (1)
8/8/2003 8:06:18 PM
excel.misc 78881 articles. 5 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 3


Similar Artilces:

Create a list with multiple criteria
I have a data base with 1,000's of addresses w/zipcodes (Sheet 1 columns A to E, E being zipcodes). After setting a base address I get all of the zipcodes within a given radius (in this case 70 zipcodes), listed in Sheet 2, Column A. Next, I use COUNTIF (in column B) to find how many addresses are in each zipcode, in this example there are 46 addresses within the 70 zipcodes. What I want to do is create a list in sheet three that will list each with the data from Sheet 1 columns A to E). Any help would be appreciated. Ronbo ...

Is there policy setting to prevent saving file without extension?
I previously posted related question in Office Developer Add-in group... ....but I did not get any response, so I have reframed a more general question here. In one particular environment (Terminal Services session on MS windows server 2003 standard edition SP2 with Office Professional Plus 2007 SP2), when I try to save a file (programmatically) withOUT .docx extension, the file is automatically saved with the extension. (The ...

Removing multiple hyperlinks
I've got data copied into my spreadsheet that includes hyperlinks. Ther are thousands of these in a column. I can remove individually by right-clicking and selecting Hyperlink an Remove. I can then arrow down and do a control Y, cell by cell, What I want to do is highlight the column and be able tp remove th hyperlinks all at once. I've exhausted myself peering through knowlegebases and groups, bu cannot find any way to make this work. Thanks for any input you can provide -- Message posted from Hi one way: Use the following macro to remove hyperlinks...

Charting multiple multiples
Hopefully I can explain this in a way that will be understood. Data: Place A Place B Place C FWD Back FWD BACK FWD Back Org_1 1 2 3 2 1 3 Org_2 2 5 4 6 1 4 I would like to place the data so that FWD and Back data is stacked on top of each other in different colors, and placed in one row on a 3-D chart as Org-1 and a second row as Org_2. Any ideas? Thanks. If you arrange your data like this: Back FWD Org_1 Place A 2 1 Place B 2 3 Place C 3 1 Org_2 Place A 5 2 ...

Multiple Hyperlinks In Same Shape Doesn't Work
Can anyone tell me how I can get multiple hyperlinks in the same shape to work? I have no problem inserting the hyperlinks, but they all point to only one. I scoured these posts, and found this (*&hl=en&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.visio.*&, which doesn't appear to work. Thanks in advance-- RAD Um, which version of Visio are you using? As far as I know, at least Visio 2002 and Visio 2003 support multiple hyperlinks. Can't...

Outlook Creating Huge Files
I have Win XP with Outlook 2000 SP3. I noticed this problem after I down loaded the latest updates. When I connect to download e-mail, the system creates these huge files labled McV...tmp. In a matter of minuites, I lost over 40 gigs of space. I tried System Restore, but all of my restore points have been wiped out. I have figured out how to clean the tmp files. I ran Detect and Repair but that has not helped. Any ideas? If you run McAfee virus products, there is a known issue with their last update. You might want to visit their website (or call their product support line) to ...

Task updates are lost in PS2007
We are using timesheets only and the resource enters their actual hours and remaining hours within thie timesheet. We only alllow resources to provide thier task updates via the timesheet. We are also using the codeplex and do not use the my task page at all. Sometimes the status manager does not get their task updates, but the actual hours show in the timesheet that was saved and submitted. Do you know of a fix for this, or is this a known bug? Hi, This NG is for the desktop versions of MS Project. Better repost in microsoft.public.project.server Greetings, -- Jan D...

Multiple Profiles, multiple accounts, multiple machine configuring?
Is there a vb or related method of adding *both* profiles *and* email accounts to multiple users logins from the administrator account? I have a network which is a workgroup (NOT a domain), in which there are about 15 users that are replicated on each of 5 machines. I'd like to be able to add all 15 Mail Profiles, and all 15 email accounts to each of the 15 logins on these 5 machines--obviously with as little work as possible. The mail is all retrieved from the same Exchange Server, but these machines *cannot* be added to a domain (don't ask!). I'd hate to have to log into ...

distributing data into multiple cells
hii i have to prepare an exel sheet of some 2000 products..i have to copy d data from the net and then prepare the sheet,with 4 different columns for 4 diff types of when i copy data nad paste is as all goes in a single cell in a row .how can i distribute the data l into multiple cells????????? -- jaspreet ------------------------------------------------------------------------ jaspreet's Profile: View this thread: can you show some samp...

Single click selects multiple cells
When clicking on a single cell multiple cells are selected. The one time solution for this is to zoom in or out. This is problematic as 60% seems to be the zoom that works most of the time but at this zoom level the cell contents do not display. The time lost and the frustration that builds is killing my productivity and office attitude. Please give all of us a permanet fix. -- Thanks Mike ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" butt...

[CRM 4.0] Error in viewing/closing an email in CRM.
A user has just reported that closing (and sometimes viewing) an email in CRM causes the following error: <CrmScriptErrorReport> <ReportVersion>1.0</ReportVersion> <ScriptErrorDetails> <Message>Object doesn't support this property or method</Message> <Line>636</Line> <URL>/ThunderbirdProducts/activities/email/edit.aspx?id={BF8747A0-2DE6-DD11-8891-000D60EBAB8E}&_CreateFromType=10000&_CreateFromId=%7b8D8276C0-ACFD-DB11-A425-000D60EBAB8E%7d</URL> <PageURL>/Thunderb...

jpg files
I have had several users experiencing problems opening pictures from Outlook 2000. Their O/S is XP Pro. Any ideas? Thank You, Jamie ...

Using Off-line files to synchronise pst file
This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C52659.2A201E60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Can I use Off-line files (XP Pro SP2) to synchronise Outlook 2003 pst = file between laptop and desktop? --=20 Interim Systems and Management Accounting Gordon Burgess-Parker=20 Director ------=_NextPart_000_0022_01C52659.2A201E60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4....

Is there a way to sort multiple columns with a tab or something?
I have a 4 column spreadsheet. I want to be able to click the heading for each of the columns to hav them sort by that column if clicked. How do I do that -- Message posted from Hi why not used the soprt icon for this. Note: This could screw up your sorting if Excel does not recognize your database columns correctly -- Regards Frank Kabel Frankfurt, Germany > I have a 4 column spreadsheet. > > I want to be able to click the heading for each of the columns to have > them sort by that column if clicked. How do I do that? > > > --- > Mess...

Sending to multiple addresses
How do I send an email to multiple addresses having only the recipient see their own email address? Michelle wrote: > How do I send an email to multiple addresses having only > the recipient see their own email address? Put the addresses into the BCC: field. Note that many e-mail programs will decide such mails are spam though. >-----Original Message----- >How do I send an email to multiple addresses having only >the recipient see their own email address? >. Open your new email and go to tools, select recipient, when your address book opens select (highlight) the a...

File storage
Where and how are the files stored in the crm database for a note attachment, I need to download the file for a certain event and save it in a folder on machine without the download dialog box appearing. is it the version column of annotationbase where i only see binary,how do i query database in this case ,I am unable to do through the howto method of downloading ...

Closing workbook open as CSV
I open a CSV file in Excel, Copy two columns of data, paste the data into another workbook and then I want to cloes the CSV file without getting a prompt about saving the data to the clipboard. I am using Application.ActiveWindow.Close (False) to close the file but I'm still getting the prompt to save the data. Is there another command I should use? Thanks, Sam First, I don't go through the Windows collection. I just close the workbook. Dim CSVWkbk as workbook 'other code here 'open the csv file Workbooks.Open Filename:="somepath\somename.csv&quo...

multiple selection
How can I select multiple records into a list box? I want that for append identical records (for select records) in another table. Many thanks Florin Use a subform instead of a list box. In a subform bound to a related table, you can append as many rows as applicable. It is possible (but not simple) to use an unbound multi-select list box that is populated in the Current event of the form, and executes Append, Delete, and Update query statements based on the ItemsSelected if they are changed. You will also have to find a way to respond to the user "undoing" changes. -- Al...

Exchange 2000 Distribution Lists
Hello We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5 Is there any way to configure multiple people to be owners or editors of the distribution lists? This was possible in 5.5, but we cannot find a means of accomplishing this in 2000 Any help would be appreciated Thank yo Jason "Jason P.S." <> wrote: >We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5. > >Is there any w...

enter time into file for a time sheet
how can I enter the time automatically into a cell. perhaps a macro. hilte the cell and hit your macro or enter? I want to round the time to the nearest 1/4 hour. I also want to be able to override the automatic function The quick way to enter current time is Ctrl plus the colon (date is Ctrl plus semi-colon) but this doesn't round to the nearest 15 minutes. I think there is an add-in that would do that as a worksheet function. Here is a subroutine that might do what you want: Sub RndToQtrHr() Dim currMin As Long Dim M As Long Dim plusHour As Boolean currMin = Minute(Time) plusHour = ...

Backup program that doesn't change the file structure
Not sure if anyone or myself asked this before but I'm looking for a backup program that will copy and update modified files to another location without putting them in some proprietary file format. ntbackup from XP makes some file called .bkf and other programs seem to create their own type of files. If I have 300 files in 22 folders that I'm backing up from drive C: I want to see 300 files in 22 folders in the backup location after its done. Is this even possible? Basically a mirror of the existing data. "Gary Gary" <blah@blah.blah> wro...

Organization of files
In the next several weeks, I expect to complete my first windows application, built primarily with C++ in MFC. I will have hundreds of image files across various categories by subject matter, and probably several thousand small, compressed audio files organized in a number of ways. By nature and profession, I am very organized. But I need help in understanding what factors to consider in regard to using multiple folders in my release directory, and how to decide what resource files to possibly include in the exe itself. Is there such a thing as too many files in one directory? Is i...

Need to have a dropdown list containing multiple rows
I am setting up an form and need to create a dropdown list that will contain 8 sets of data. Each set needs to contain 3 rows of data (name, street address & city/state/zip. The goal is to allow the user to click onto the cell, see the dropdown and select which address set to use. This would then place the data into three rows suitable for mailing. I have never attempted anything like this and am in need of assistance. Thank you. --- Message posted from Pat What you ask is easily done using Data Validation drop-down list and a few Vlookups but........Ex...

Combine multiple tables into one
I took over a database in which the last person created a new table for everyday worth of data (ie. Feb-21-08 is named 022108). There are over 100 tables in the single database with the same columns and table attributes, I would like to combine all of these tables into one where I have a Date_Key field in place of the table name. I figured out how to query the table names using the following: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Now I j...

Multiple domains #6
Hi, Having done some research I have found that it is possible to send and receive email from multiple domains with Exchange 2003. I have a few questions that I would like cleared up if anyone can help. 1. Is it really as simple as configuring a recipient policy for the new domain and then changing the mail record for that domain to point to the proper IP address? 2. If I set up a new account in AD, and need this account to be associated with the second email domain, will the default SMTP email be for the first domain? If so, can I just edit this directly? 3. If I set the default SMTP add...