Dynamic filename
"JC" wrote...
mystring = Workbooks("SupportTemplate.xls").Sheets
("WorkOrders").Range("I2").Value
In the above code, is there a way to make the filename of
the spreadsheet (SupportTemplate.xls) link dynamically to
the name of the spreadsheet. Thus, if the spreadsheet
name changes, the reference in the code changes as well.
Use workbook-type object variables.
Dim wba As Workbook, wbb As Workbook
Set wba = Workbooks("foo.xls")
Set wbb = Workbooks("bar.xls")
mystring = wba.Sheets("WorkOrders").Range("I2").Value
wbb.Sheets("WOSummary").Range("X99").Value = mystring
--
To top-post is human, to bottom-post and snip is sublime.
|