alfranco17
Board Regular
- Joined
- Apr 14, 2013
- Messages
- 198
Hi.
I'll really appreciate any hints you can give me on this one.
I have the following code:
It was working fine. Suddenly, there is a computer that shows the "Error 400" dialog box.
I tried to use:
It did not work either.
If I go to the immediate window, it shows me the activeworkbook is the right one, it gives me the name of the sheet, but as soon as I try to run the macro and change the name I get error 400.
If I test it in my computer, it works. I am running Excel 2016, in Enlish. The other computer is running Excel 2013, in Spanish. But it had not failed before.
Is there a way to make the code bullet-proof and avoid that error? Or any other solutions you may think of? I am in a loop right now.
Thanks.
Armando.
I'll really appreciate any hints you can give me on this one.
I have the following code:
Code:
Sub PrepareFilesForReport()
Dim v_expense As Workbook
Dim v_template As Workbook
' Open template file.
Set v_template = Workbooks.Add(Range("Template_Path"))
' Go back to the macro workbook so that the Range("expense_Path") is available
ThisWorkbook.Activate
' Open expense file.
Set v_expense = Workbooks.Open(Range("expense_Path"))
' Make sure the file we just opened is active.
v_expense.Activate
' Move the only sheet that file has to the template.
ActiveSheet.Move Before:=v_template.Sheets(1)
' Activate the template file (should be active already).
v_template.Activate
' The following line produces error 400
ActiveSheet.Name = "ExpenseSheet"
End Sub
It was working fine. Suddenly, there is a computer that shows the "Error 400" dialog box.
I tried to use:
Code:
v_template.ActiveSheet.Name = "ExpenseSheet"
It did not work either.
If I go to the immediate window, it shows me the activeworkbook is the right one, it gives me the name of the sheet, but as soon as I try to run the macro and change the name I get error 400.
If I test it in my computer, it works. I am running Excel 2016, in Enlish. The other computer is running Excel 2013, in Spanish. But it had not failed before.
Is there a way to make the code bullet-proof and avoid that error? Or any other solutions you may think of? I am in a loop right now.
Thanks.
Armando.