无法将Application.Evaluate()用于CUBEVALUE函数

时间:2018-01-12 05:33:44

标签: excel vba excel-vba powerpivot

亲爱的MS Excel向导=)

最近我正在为预算文件开发一个@Singleton class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) { var result = ListBuffer[Item]() val res = db.run(items.result) for (r <- res) { for (r1 <- r) { result += r1 } println("initial size = " + result.size) } /** * Create an Action to render an HTML page. * * The configuration in the `routes` file means that this method * will be called when the application receives a `GET` request with * a path of `/`. */ def index() = Action { implicit request: Request[AnyContent] => println("final size = " + result.size) Ok(views.html.index()) } } ,将所有基本控件都集中到一个地方,以减轻用户的生命。我最初的想法是以这种形式计算所有主要值(起始数量为Student,完成学生人数......)并将预算文件公式作为值提供。对于某些计算,我必须解决UserForm,因此我计划使用ThisWorkbookDataModel

然而它失败的情况如下:

Application.Evaluate()

作为一种解决方法,我首先在工作表上评估此公式:

m1 = Application.Evaluate("=CUBEVALUE(""ThisWorkbookDataModel"",CUBEMEMBER(""ThisWorkbookDataModel"",{""[DimDate].[1.Year].&[" & mYear & "]"",""[DimDate].[3.MonthCalendarTrue].&[" & mMonth & "]""}),CUBEMEMBER(""ThisWorkbookDataModel"",""[Measures].[mQofStudents]""),CUBEMEMBER(""ThisWorkbookDataModel"",{""[DimCampus].[Burleigh]""}))")

然而,这确实会在Range("AvgStudStartValBH").Formula = "=CUBEVALUE(""ThisWorkbookDataModel"",CUBEMEMBER(""ThisWorkbookDataModel"",{""[DimDate].[1.Year].&[" & mYear & "]"",""[DimDate].[3.MonthCalendarTrue].&[" & mMonth & "]""}),CUBEMEMBER(""ThisWorkbookDataModel"",""[Measures].[mQofStudents]""),CUBEMEMBER(""ThisWorkbookDataModel"",{""[DimCampus].[Burleigh]""}))" 中刷新结果时带来不便。

我在调试此UserForm问题时发现的问题是,如果我最后删除Application.Evaluate(),它就可以了!那么CUBEMEMBER()可能有符号限制吗? 如果是这样,除了将其粘贴到Excel工作表中以进行评估之前还有其他解决方法吗?

0 个答案:

没有答案