I want to start by saying sorry if this question has already been asked, and if it has been asked in a better way! I've been searching all day but just can't find the answer. I'm also new to powershell so please be patient.
I just wrote a simple script that will copy a file from a network drive, to a locate folder in the goal to add a new group to the Excel Ribbon bar filled with Macros I created.
Script so far:
**************************************************************************************
$UIexists = test-path "C:\Users\$env:username\AppData\Local\Microsoft\Office\Excel.officeUI"
If ($UIexists -eq $False)
{
cpi "N:\NetworkFolder\Excel.officeUI" "C:\Users\$env:username\AppData\Local\Microsoft\Office\"
(gc C:\Users\$env:username\AppData\Local\Microsoft\Office\Excel.officeUI) | foreach-object {$_ -replace '%USERID%',$env:username} | set-content C:\Users\$env:username\AppData\Local\Microsoft\Office\Excel.officeUI
}
elseif ($UIexists -eq $True){Echo "You already have a Custom UI. Please go see Alex before you go any further!"
}
**************************************************************************************
I would like to add a portion in the "elseif" section that will instead just copy text from the source file "N:\NetworkFolder\Excel.officeUI" and just place it in the file that already exists at "C:\Users\$env:username\AppData\Local\Microsoft\Office\Excel.officeUI"
I would be looking for the text between the tags <mso:tab> and </mso:tab> from the source file and then pasting it into the existing file, after a </mso:tab> tag that is already present.
I'm sure there is an easy way to code it or an easier way to do it (with script and not doing it manually of course) but I can't figure it out.
Thank you very much!!!