VBA TM1RECALC Problem
Posted: Tue Jun 29, 2010 4:20 pm
Hi there
I am making a .xla file as an addin for our users so that they can calculate just a workbook and not all open books within Excel.
I've got the code working but the calculation works intermittently and I'm not sure which is the most reliable command to use?
appication.run "TM1Recalc1" seemed to always work yesterday but today it won't but application.run "TM1Recalc" will work.
I've also tried application.calculate which was working and application.run "TM1Refresh"
Does anyone know which is the most reliable command to run the calculation (and why one command works one day and not another?).
I'm using TM1 in a Citrix environment with windows XP and office 2003 the TM1 version is 9.0.
(I've also had problems with the normal Excel functionality F9 and shift+F9 not always forcing TM1 to calc)
Helen
Please see the code that I am using below:
I am making a .xla file as an addin for our users so that they can calculate just a workbook and not all open books within Excel.
I've got the code working but the calculation works intermittently and I'm not sure which is the most reliable command to use?
appication.run "TM1Recalc1" seemed to always work yesterday but today it won't but application.run "TM1Recalc" will work.
I've also tried application.calculate which was working and application.run "TM1Refresh"
Does anyone know which is the most reliable command to run the calculation (and why one command works one day and not another?).
I'm using TM1 in a Citrix environment with windows XP and office 2003 the TM1 version is 9.0.
(I've also had problems with the normal Excel functionality F9 and shift+F9 not always forcing TM1 to calc)
Helen
Please see the code that I am using below:
Code: Select all
Private Sub Calc_This_Book()
answer = MsgBox(prompt:="The current active workbook will calculate. If you have more than one workbook which needs to calculate please use shift+control+F9. Would you like to continue?", Buttons:=36)
If answer = vbYes Then
currentbook = ActiveWorkbook.Name
CurrentSheet = ActiveSheet.Name
CurrentCellAddress = ActiveCell.Address
Application.ScreenUpdating = False
'disable calculation on all workbooks/sheets
For Bookcount = 1 To Workbooks.count
Workbooks(Bookcount).Activate
For sheetcount = 1 To Sheets.count
Worksheets(sheetcount).EnableCalculation = False
Next sheetcount
Next Bookcount
'enable calculation on all sheets of users workbook
Workbooks(currentbook).Activate
For sheetcount = 1 To Sheets.count
Worksheets(sheetcount).EnableCalculation = True
Next sheetcount
'Application.Calculate
Application.Run "TM1RECALC"
'Application.Run "TM1RECALC1"
'Application.Run "TM1REFRESH"
'enable calculation on all sheets of all workbooks
For Bookcount = 1 To Workbooks.count
Workbooks(Bookcount).Activate
For sheetcount = 1 To Sheets.count
Worksheets(sheetcount).EnableCalculation = True
Next sheetcount
Next Bookcount
Workbooks(currentbook).Activate
Worksheets(CurrentSheet).Activate
Range(CurrentCellAddress).Activate
MsgBox ("Your workbook has completed it's calculation.")
End If
Application.ScreenUpdating = True
End Sub