更改图表系列公式和预防图表激活

时间:2018-10-12 13:57:49

标签: excel vba charts

最后一行自动激活图表。我可以预防吗? (我不想在事实发生后再激活其他东西。)

$appId = "{app-id}"
$pathToAppRolesJson = "app-roles.json"

# Read all desired app roles from JSON file
$appRolesFromJson = Get-Content -Path $pathToAppRolesJson -Raw | ConvertFrom-Json

# Build a new list of Azure AD PowerShell AppRole objects
$appRolesForApp = @()
$appRolesFromJson | ForEach-Object {

    # Create new Azure AD PowerShell AppRole object for each app role
    $appRole = New-Object "Microsoft.Open.AzureAD.Model.AppRole"
    $appRole.AllowedMemberTypes = $_.allowedMemberTypes
    $appRole.Description = $_.description
    $appRole.DisplayName = $_.displayName
    $appRole.Id = $_.id
    $appRole.IsEnabled = $_.isEnabled
    $appRole.Value = $_.value

    # Add to the list of app roles
    $appRolesForApp += $appRole
}

# Update the Application object with the new list of app roles
$app = Get-AzureADApplication -Filter ("appId eq '{0}'" -f $appId)
Set-AzureADApplication -ObjectId $app.ObjectId -AppRoles $appRolesForApp

1 个答案:

答案 0 :(得分:1)

FormulaLocal属性使您可以设置公式值,而无需激活图表/系列

Sub NewChart()
Dim chart1                                      As Chart
Dim newformula                                  As String
Dim SC                                          As SeriesCollection
Dim mySeries                                    As Series
Dim STR                                         As String

    Set chart1 = ActiveSheet.ChartObjects("Chart 1").Chart
    Set SC = chart1.SeriesCollection
    Set mySeries = SC.Item(1)
    STR = SC.Item(1).Formula

    mySeries.FormulaLocal = STR
    Debug.Print TypeName(Selection)
End Sub