Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How can I define a name in Excel using Powershell?

$
0
0

I know how to reference existing names using the RANGE function but how can I create a new defined name using Powershell?

 

My specific case involves defining a name for a single cell with a workbook scope.  Just as if you were to right-click a cell in Excel and choose Define Name.

 

The closest I've gotten is the NAMES object for the workbook but when I "gm" that all I see is a method for delete - nothing for adding.

$xlsx  = "c:\Sample.xlsx"
$excel = new-object -comobject Excel.Application
$xlb = $excel.Workbooks.Open($xlsx)
$xlb.names | gm  



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>