VBA运行时错误91

时间:2016-02-26 21:49:54

标签: vba excel-vba excel-2013 excel

我为一个形状分配了一个宏,但是我收到了运行时错误' 91'对象变量或未设置块变量。但是,当我从Developer选项卡运行Macro时,它可以工作。 " ActiveChart.Axes" line是错误的来源。我是VBA的新手,所以任何帮助都会受到赞赏。我应该更换" ActiveChart.Axes"使用" ActiveSheet.ChartObjects"?

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    _v = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setFrame:CGRectMake(0, 0, 50, 30)];
    [btn setTitle:@"Button" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [_v addSubview:btn];
    _v.backgroundColor = [UIColor redColor];
    [[[UIApplication sharedApplication] keyWindow] addSubview:_v];

}

- (void)btnClicked:(id)sender {

    NSLog(@"Btn Clicked");

    [UIView animateWithDuration:0.2
                          delay:0.1
                        options: UIViewAnimationOptionCurveEaseOut
                     animations:^
     {
         _v.frame = CGRectMake(-_v.frame.size.width, 

_v.frame.origin.y, _v.frame.size.width, _v.frame.size.height);
         }
                         completion:^(BOOL finished)
         {
         }];
    UIViewController *c = [self.storyboard instantiateViewControllerWithIdentifier:@"TestVC"];
    [self.navigationController pushViewController:c animated:YES];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

1 个答案:

答案 0 :(得分:4)

with语句之前添加以下行。

ActiveSheet.ChartObjects("Chart 1").Activate

假设"图表1"是图表的名称。

相关问题