我为一个形状分配了一个宏,但是我收到了运行时错误' 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.
}
答案 0 :(得分:4)
在with
语句之前添加以下行。
ActiveSheet.ChartObjects("Chart 1").Activate
假设"图表1"是图表的名称。