cancel
Showing results for 
Search instead for 
Did you mean: 

Renamed Worksheet

kevin_guillemie
Level 3
Hi there, I'm trying to rename a worksheet but i have some errors. Could you help me please ? 'Here in VBA 'Sheets(worksheetName).Select 'Sheets(worksheetName).Name = newName 'ws.Name = newName 'What i put on BluePrism 'First Try Dim ws As Object ws = GetWorkSheet(handle, workbookName, worksheetName) ws.Select ws.set(handle, workbookName, newName) 'Error : Internal : Could not execute code stage because exception thrown by code stage: Public member 'set' on type 'Worksheet' not found. 'Second try - Should be worked ? It talks about wrong worksheet name but i have checked Dim ws As Object ws = GetWorkSheet(handle, workbookName, worksheetName) ws.Select ws.Name = newName 'Internal : Could not execute code stage because exception thrown by code stage: Vous avez tapé un nom de feuille ou de graphique non valide. Vérifiez les points suivants : €¢ Le nom ne dépasse pas 31 caractères. €¢ Le nom ne contient aucun des caractères suivants : \ / ? * [ ou ] €¢ Le champ du nom n'est pas vide. Thanks, Regards, KG
3 REPLIES 3

jgreaves2
Level 4
Hi, Based on the error you are detailing, the experience I have is you have one of the following problems: -Tab names for worksheets have a limited character length or 31 - Make sure the input you are using doesn't exceed this. Keep in mind spaces are classed as a character in tab names. -Tab name are highly restricted for special characters - Make sure you are using simple text Ampersand are allowed but I would using only 1 and the rest basic chars. Thanks, James

kevin_guillemie
Level 3
Hi James, Thank you for your reply, i have ever checked these details. worksheetName = ""monClasseur"" new worksheetName = ""monClasseurRenamed"" With regards, KG

kevin_guillemie
Level 3
Problem solved for me. Here the code : Dim ws As Object ws = GetWorkSheet(handle, workbookName, worksheetName) ws.Select ws.Name = newName