Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get file name for FileSaveAs


I'm new at this. With much help from this forum I've almost finished a
major timesaving macro for our lab. But stuck on following problem. I
load a list of files that are in a worksheet and do a for-next loop on
them,. Before closing each file I want to save it as an XLS file AND as
a text file. I don't understand VBA syntax well enough to know how to
get the filename for the filesave command.

My code now:
Sub File_Cut_Metrics()

Dim wbList As Workbook
Dim wbDest As Workbook
Dim rcell As Range

Set wbList = Workbooks.Open("G:\newlist2")
For Each rcell In
wbList.Sheets(1).Range("A1").CurrentRegion.Columns (1).Cells
Set wbDest = Workbooks.Open(rcell.Value)

do some stuff

wbDest.Save
WBDEST.SAVEAS FILENAME:=RCELL, FILEFORMAT:=XLTEXT, CREATEBACKUP:=FALSE
wbDest.Close savechanges:=False
Next

End Sub

What do I need to change to send the right filename to the SaveAs
statement?

TIA,

Rob


--
rroach
------------------------------------------------------------------------
rroach's Profile: http://www.excelforum.com/member.php...o&userid=21093
View this thread: http://www.excelforum.com/showthread...hreadid=387193

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get file name for FileSaveAs


try :

wbDest.SaveAs Filename:=rcell.Value, FileFormat:=xlText,
CreateBackup:=False

I'm not sure but this may solve your problem.

rcell is set to a range, you want the file name to be the value in that
range.


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=387193

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get file name for FileSaveAs


I had tried the option of rcell-value and it doesn't work. Get error ms
and no text file. Any other suggestions anyone

--
rroac
-----------------------------------------------------------------------
rroach's Profile: http://www.excelforum.com/member.php...fo&userid=2109
View this thread: http://www.excelforum.com/showthread.php?threadid=38719

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 FileSaveAs dialog freezes when used via automation from Access No Name Excel Programming 0 May 15th 05 08:49 AM
Auto filesaveas vba code alanford Excel Programming 3 February 18th 05 10:31 AM
i received a file that reads powerpoint document file file exten. CCAROLACEREC Excel Discussion (Misc queries) 1 December 4th 04 05:02 PM
If user says "No" to FileSaveAs Overwrite? OceansideDJ Excel Programming 5 October 30th 04 01:58 AM
Forcing a FileSaveAs John Petty Excel Programming 6 September 14th 03 01:44 AM


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