PlanMaker and PowerShell

Post your questions, bug reports and suggestions here for PlanMaker 2018 for Windows.

Moderator: SoftMaker Team

Post Reply
EricC
Posts: 184
Joined: Mon Oct 01, 2007 11:40 pm

PlanMaker and PowerShell

Post by EricC » Sun Sep 22, 2019 10:07 pm

Hi,

So I am playing around with PlanMaker and PowerShell. I am basing some of this code off code I have from a PowerShell script to enumerate AD groups and populate an Excel spreadsheet. Starting small, I thought I would create the spreadsheet and autofit the column.

$groupName = 'somereallylongname'
$row = 1
$column = 1
$pmSpreadsheet = New-Object -ComObject PlanMaker.Application
$pmSpreadsheet.Visible = $True
$workbook = $pmSpreadsheet.Workbooks.Add()
$worksheet = $workbook.ActiveSheet
$worksheet.Cells.Item($row, $column).Value = $groupName
$worksheet.Range("A:B").AutoFit

If run the above code in a PowerShell console everything works up until the AutoFit. Which throws the following message:

OverloadDefinitions
-------------------
void AutoFit ()

I converted the code to BasicScript, ran it in the BasicScript editor, and everything works as expected.

Any ideas?

Thanks,
-Eric

W10 1903 x64
SMO2018 x64 Rev970

Post Reply

Return to “PlanMaker 2018 for Windows”