error when using variable name for workbook
have you wrote declaration for contractfilename variable in declarations
section?
that must be done to use variables between subs..
"Emma" kirjoitti:
I am getting an error he
Sheets("Sheet1").Copy After:=Windows(sFile).Sheets(1)
which says that
"Object doesn't support this property or method"
Here is the code that I used:
Call GetContractFileName
Workbooks.Open
FileName:="G:\USER\Contracts\Data_Files\All_2004_C atalog.xls"
sFile = contractfilename
cntNo = ContractNo
Sheets("Sheet1").Copy After:=Windows(sFile).Sheets(1)
Windows(sFile).Activate
Sheets(cntNo).Select
_____________________________________
Public Function GetContractFileName()
ContractNo = InputBox("Enter the Contract Number: ", "Contract File")
contractfilename = ContractNo & ".xls"
End Function
|