Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Modifying currently open Excel documents with PowerShell?

$
0
0

First of all apologies if it's not the right forum... new here. I'm trying to modify a currently open (as in user is looking at the document) with PowerShell, and nothing I've tried is working. I can read from the document just fine. I can even make changes and save a separate copy of the document just fine. I can even make changes, and then close and re-open the document and the changes persist just fine, but the changes never show up in the live document view that the user is looking at. Is this at all possible or do I need to re-think my strategy here? Is my approach wrong?

Example code:

    $Excel = [Runtime.Interopservices.Marshal]::GetActiveObject('Excel.Application')

    $Workbook = $Excel.Workbooks.Open($ExcelFilePath)

    $Worksheet = $Workbook.Worksheets.Item(1)

    $Worksheet.name = 'testing'

    $Workbook.save()

 

Thanks in advance for any help.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles