A
Andyjim
I am trying to saving a file based on the text name in a designated cell in
the workbook. In other words, I am trying to save the open file as the name
that is in a cell in that open file's worksheet. Evidently, the code below
is not the way to approach it. I get an out of subscript error. Can anyone
point me in the right direction? It seems like this shouldn't be such a hard
thing, but I am baffled.
However, with this code, I get an “subscript out of rangeâ€
error. I am running out of ideas. There must be a way to do this! Seems
to be problem with variable.
Thanks for your help.
Windows("fxRM_Update.xls").Activate
Dim bk As Workbook, bk1 As Workbook
Dim sstr As String
Dim path2 As String
path2 = ActiveWorkbook.Path
Set bk = Workbooks("fxRM_update.xls")
sstr = bk.Worksheets("lookup").Range("d39").Value
Set bk1 = Workbooks(sstr) THIS IS WHERE SUBSCRIPT ERROR OCCURS
ActiveWorkbook.SaveCopyAs filename:= bk1
'bk1.saveas
'ActiveWorkbook.SaveCopyAs filename:= p & bk1
' ActiveWorkbook.SaveCopyAs filename:=path2 & "\" & bk1
the workbook. In other words, I am trying to save the open file as the name
that is in a cell in that open file's worksheet. Evidently, the code below
is not the way to approach it. I get an out of subscript error. Can anyone
point me in the right direction? It seems like this shouldn't be such a hard
thing, but I am baffled.
However, with this code, I get an “subscript out of rangeâ€
error. I am running out of ideas. There must be a way to do this! Seems
to be problem with variable.
Thanks for your help.
Windows("fxRM_Update.xls").Activate
Dim bk As Workbook, bk1 As Workbook
Dim sstr As String
Dim path2 As String
path2 = ActiveWorkbook.Path
Set bk = Workbooks("fxRM_update.xls")
sstr = bk.Worksheets("lookup").Range("d39").Value
Set bk1 = Workbooks(sstr) THIS IS WHERE SUBSCRIPT ERROR OCCURS
ActiveWorkbook.SaveCopyAs filename:= bk1
'bk1.saveas
'ActiveWorkbook.SaveCopyAs filename:= p & bk1
' ActiveWorkbook.SaveCopyAs filename:=path2 & "\" & bk1