R
rroach
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
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