SaveAs produces subscript error
It could be the file extension that is causing the problem, if the value in
d39 does not have one.
Try:
Set bk1 = Workbooks(sstr & ".xls") 'modify for xl2007
ActiveWorkbook.SaveCopyAs filename:=bk1
"Andyjim" wrote:
I am trying to saving a file based on the text name in a designated cell in
the workbook. However, with this code, I get an €śsubscript out of range€ť
error. Do you know what I am doing wrong?
Thanks for your help.
Windows("fxRM_Update.xls").Activate
Dim bk As Workbook, bk1 As Workbook
Dim sstr As String
Set bk = Workbooks("fxRM_update.xls")
sstr = bk.Worksheets("lookup").Range("d39").Value
Set bk1 = Workbooks(sstr)
ActiveWorkbook.SaveCopyAs filename:=Workbooks(bk1)
Andy
|