PowerShell Script. Trying to use Formula & String in Naming Tab

Benzula

Board Regular
Joined
Feb 28, 2014
Messages
248
So I need to be able to name an Excel Tab the Current Year * 100 + Current Month + the text "(OSC)" for a result of this month being

201705 (OSC)

$ExcelWorksheet.Name = (get-date).Year * 100 + (get-date).Month ----- This Gives me the 201705


$ExcelWorksheet.Name = '(OSC)' ---- This Gives me the '(OSC')

$ExcelWorksheet.Name = (get-date).Year * 100 + (get-date).Month + ' (OSC)' ----- This gives me an error. I am assuming because it is trying to add instead of concatenate.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Code:
[COLOR=#333333][FONT=&quot][SIZE=1][COLOR=#ff4500]$ExcelWorksheet[/COLOR][/SIZE][/FONT][/COLOR][COLOR=#333333][FONT=&quot][SIZE=1][COLOR=#a9a9a9][SIZE=1][COLOR=#a9a9a9][SIZE=1][COLOR=#a9a9a9].[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][COLOR=#333333][FONT=&quot][SIZE=1][SIZE=1]Name = [/SIZE][/SIZE][/FONT][/COLOR]get-date -format yyyyMM' (OSC)'
 
Upvote 0

Forum statistics

Threads
1,214,886
Messages
6,122,093
Members
449,064
Latest member
Danger_SF

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top