From 045234dd81c8e5f482f3d0a5d3feafc516267d69 Mon Sep 17 00:00:00 2001 From: dfinke Date: Sat, 30 Apr 2016 15:23:13 -0400 Subject: [PATCH] Only load PS Class for -gt V5. Thanks https://github.com/W1M0R --- ImportExcel.psm1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ImportExcel.psm1 b/ImportExcel.psm1 index 295b01f..935b35b 100644 --- a/ImportExcel.psm1 +++ b/ImportExcel.psm1 @@ -16,15 +16,23 @@ Add-Type -Path "$($PSScriptRoot)\EPPlus.dll" . $PSScriptRoot\Get-HtmlTable.ps1 . $PSScriptRoot\Import-Html.ps1 . $PSScriptRoot\Get-Range.ps1 -. $PSScriptRoot\plot.ps1 -function New-Plot { - [OutputType([PSPlot])] - param() +if($Host.Version.Major -ge 5) { + . $PSScriptRoot\plot.ps1 - [psplot]::new() + function New-Plot { + [OutputType([PSPlot])] + param() + + [psplot]::new() + } + +} else { + Write-Warning "PowerShell 5 is required for plot.ps1" + Write-Warning "PowerShell Excel is ready, except for that functionality" } + function Import-Excel { param( [Alias("FullName")]