View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sowetoddid[_19_] sowetoddid[_19_] is offline
external usenet poster
 
Posts: 1
Default Saveas with name of another file

This is the code I am using to open another excel file, copy data an
paste it into the original file. Is it possible to add a line in thi
macro that will do a saveas on the original workbook (ThisWB)? I woul
like to do a saveas with the name of the other file (OpenedWB) and "-F
for Finished.

So, ThisWB would have a saveas with the name being "OpenedWB - F".

Sub testIt()
Dim ThisWB As Workbook, OpenedWB As Workbook, _
OpenFileName As Variant
Set ThisWB = ThisWorkbook
OpenFileName = Application.GetOpenFilename()
If LCase(TypeName(OpenFileName)) = "boolean" Then
Else
Set OpenedWB = Workbooks.Open(OpenFileName)
OpenedWB.Sheets(1).Range("A1:Z100").Copy
ThisWB.Worksheets("sheet1").Range("b1").PasteSpeci al _
xlPasteValuesAndNumberFormats
OpenedWB.Close False
End If
End Sub


Thank you

--
Message posted from http://www.ExcelForum.com