Excel 2013

This topic contains 3 replies, has 3 voices, and was last updated by  Tim Pringle 2 years, 5 months ago.

  • Author
    Posts
  • #25529

    Wilfredo Perez
    Participant

    At work I have Excel 2010 and I use the following code which works fine

    Add-Type -AssemblyName Microsoft.Office.Interop.Excel
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible = $true
    $workbook = $excel.Workbooks.add()
    $wrksht = $workbook.Worksheets.Item("Sheet1")
    $wrksht.Name = "Hello"
    

    The same code in Excel 2013 only opens excel and gives me 1 sheet and does not rename sheet1 like in Excel 2010

  • #25542

    Richard Siddaway
    Moderator

    I've just tested your code using Excel 2013 and the rename worked for me

  • #25543

    Wilfredo Perez
    Participant

    Thanks for testing my code.

  • #25602

    Tim Pringle
    Participant

    Hey Wilfredo,

    +1 for it working okay, just tried in on my system with O2K13 and it works good.

    Do you have any autoload macros configured for excel, or any additional security settings?
    Maybe an idea to also try with a clean profile. Trying creating a new user local user on your system, login with that, and try it (you might need to run excel once before to get rid of all the first start stuff)

You must be logged in to reply to this topic.