Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel wants to save an open file to another filename in VBA script

Hi,
I'm having a real strange problem here which I really want to be solved.

An XLS file with VBA code is used to update some other XLS files (with and
without VBA). At a certain moment, the VBA script for updating wants to save
the open XLS file. This has been going on for years without a problem, but
now, since last week, a save dialog comes up suggesting a random name. When I
click "cancel", the following message comes up:
"Run-time error 1004: Your changes could not be saved to '(filename)', but
were saved to a temporary document 'C5879400'. Close the existing document "
and so on.

What I tried to solve this:
* Try it on another system with the same version of Excel on it (Excel 2002
SP 3), there it works.
* Removing the temporary files from the C:\Documents and
Settings\(username)\Local Settings\Temp directory. This solves the issue -
sometimes.

The code exerpt where it happens:
Windows("(filename)").Activate
Range("A1").Select
Sheets("(sheetname)").Select
Cells(1, 248) = Finperfact
Columns("A:DG").Select
Selection.Columns.AutoFit
Range("C2").Select
Application.Run "(filename)!(methodname1)"
Application.Run "(filename)!(methodname2)"
Application.Run "(filename)!(methodname3)"
Application.Run "(filename)!(methodname4)"
ActiveWorkbook.Save

(filename), (sheetname) and (methodnameX) are just used to obfuscate the
code and are, of course, not written like that in the real source code.
The error occurs on executing ActiveWorkbook.Save.

The lines before ActiveWorkbook.Save run some VBA code in the file that will
be saved by ActiveWorkbook.Save. While this might have to do something with
the problem (a lock being set while executing, I don't know) but it has been
working for years like this, so I'm not sure at all.

Since on other workstations the problem doesn't occur, I guess it has to do
something with certain settings in the OS or in Excel. But as the system on
which the problem occurs fulfills the role of a file server, just switching
workstations is not an option. Does anybody have any suggestion?

Kind regards and thanks in advance,
Bart Poppe

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
Excel 2007 Can't Save File with VB Script but it can in 97/2003format??? [email protected] Excel Discussion (Misc queries) 2 February 9th 09 03:38 PM
can't save VBA script when saving excel file thinktwice Excel Discussion (Misc queries) 5 December 27th 06 07:38 AM
Save Excel File every wednesday VB Script Help sam76210 Excel Programming 2 March 8th 06 08:12 PM
Save Excel File every wednesday VB Script Help !! sam76210 Excel Discussion (Misc queries) 0 March 8th 06 04:05 PM
Script to save Excel file to the server. raj41977 Excel Discussion (Misc queries) 3 December 8th 05 02:48 PM


All times are GMT +1. The time now is 01:10 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"