Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SaveAs function 1

Status
Not open for further replies.

Smoothas

IS-IT--Management
May 1, 2002
93
GB
Hello again,
I have a macro that tries to save an imported RTF file to xls, with the date added to the end. Everything looks ok, but when I run it and click the SAVE button, it dosn't get saved in that location.
I've tried other locations, and get the same result ( I have admin access to the whole drive ).

Any ideas ?
Thanks in advance
Gerald

Sub SaveAsOption()

''''''' save file as XLS
Application.StatusBar = False
MyFile = Application.GetSaveAsFilename(InitialFileName:="C:\NewFile " _
& Format(Date, "yyyy_mm_dd"".xls"), _
fileFilter:="Excel Files (*.xls), *.xls")
End Sub
 
C:\NewFile[highlight]\[/highlight]

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Hi,
Thanks for the quick reply.
The "namefile" bit is the name of the file ie:
c:\newfile 2008_12_05.xls.

I did try replacing the spaces with underscores, but I get the same problem , ie: it looks like it saves, but there is no file in the location, or anywhere on the disk, with that file name.

Thanks again
 
Sorry - I misunderstood your problem.

you are making MyFile equal the text string of the saved file path, but you never actually do the saving.

Add this line at the end:
Code:
activeworkbook.saveas MyFile


[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Oh, and btw - the space won't mess things up.

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
BINGO.
I do believe your are a genius :)

Thanks you everso. That been driving me potty for 3 hrs

Thanks

Gerald
 
Glad I could help. I've been there, too. 'code blindness', I call it.

[gray](code blindness TM 2008 AnotherHiggins)[/gray]

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top