1

I'm having trouble renaming worksheets with the package RDCOMClient and I'm not sure what's going wrong. The code below will print out the name of the active worksheet, so the reference is working.

print(wb$ActiveSheet()[["Name"]])

But when I try to assign a new name with the following code nothing happens.

wb$ActiveSheet()[["Name"]] <- "Summary"

I've tried assigning wb$ActiveSheet() to a variable and then doing this:

x[["Name"]] <- "Summary"

And still I can't get the name to change, it still remains as "Sheet1". Any help?

SpottieO
  • 11
  • 4
  • 1
    Can you show full code block and not snippets? Are you saving changes? How are you checking sheet name? – Parfait Jan 19 '17 at 18:51

1 Answers1

0

I don't think you can assign ActiveSheet.Name directly. Instead, try:

wbActiveNum <- wb$ActiveSheet()[['Index']]
wbSheet <- wb$Worksheets()[[wbActiveNum]]
wbSheet[['Name']] <- 'Summary'
Project_H
  • 59
  • 2
  • 10