yesthattom: (Default)
[personal profile] yesthattom
I’m writing a macro that, among other things, saves the MS-Excel spreadsheet:

ActiveWorkbook.SaveAs Filename:= “EventList.txt”, FileFormat:= xlText

However, every time it runs I get a dialog box asking for permission to replace the old file.

Anyone know how to disable that box?

Date: 2005-05-22 03:43 pm (UTC)
cos: (Default)
From: [personal profile] cos
I know nothing about Excel macros, but if there isn't a way to disable that box, how about:
- rename the old file
- save the new file
- if the save was successful, delete the renamed file

Date: 2005-05-22 06:43 pm (UTC)
From: [identity profile] likethewatch.livejournal.com
Instead of trying to disable the box, I would build into the macro the action of pressing the OK button to continue.

Date: 2005-05-23 08:28 am (UTC)
From: [identity profile] chhotii.livejournal.com
How is that possible? I don't think the SaveAs function returns until after the box has been dismissed, does it?

Date: 2005-05-23 09:39 am (UTC)
From: [identity profile] yesthattom.livejournal.com
When I record the macro, then view the macro source it has nothing like that. Can you give me some pointers?

The ORA books that I have all delete the file right before they do the save. LAAAAME.

Date: 2005-05-23 07:17 pm (UTC)
From: [identity profile] likethewatch.livejournal.com
Problem is when *I* write a macro, it's by turning on the Record button. I don't know how to program at *all* and rely entirely on the GUI.

I just recorded a macro that saved the file with the same filename as an existing one, so I'd be prompted to overwrite the existing file. This is what it recorded:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Administrator\My Documents\foo.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Does that help you at all?

Date: 2005-05-23 09:12 am (UTC)
From: [identity profile] chhotii.livejournal.com
What version of Excel are you using? I have here Excel X for Macintosh Service Release 1. It won't even run your code snippit, it gives an error "Run-time error '424': Object Required", which mystifies me.

Date: 2005-05-23 09:38 am (UTC)
From: [identity profile] yesthattom.livejournal.com
I'm using Mac Office 2004.

Tom

December 2015

S M T W T F S
  12345
6789 101112
13141516171819
202122 23242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 21st, 2025 01:08 pm
Powered by Dreamwidth Studios