Too lazy to copy?

Post Reply
Wim Gielis
MVP
Posts: 3223
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Too lazy to copy?

Post by Wim Gielis »

Hi there

Just playing around a bit... :D

Yet another method to transfer data to TM1 (although there are abviously better methods out there).

Open a view in a cube viewer (for instance using Architect) and put your cursor on a cell where you'd want to copy a bunch of cells from Excel.

Use a bit of code in VBA:

Code: Select all

Sub CopyToTM1()
    [A1].Copy 'or: [B2].CurrentRegion.Copy, or refer to another sheet, or make it even more dynamic
    AppActivate "Cube Viewer: SERVER NAME->CUBE NAME->VIEW NAME" 'change over here: it should be the window caption of your cube view
    Application.SendKeys "^v" 'mimick Ctrl-V
    AppActivate Application.Caption
    Application.CutCopyMode = False 'take away the ants trace
End Sub
Using the clipboard:

Code: Select all

Sub CopyToTM1()
    Dim DataObj As New MSForms.DataObject
    DataObj.SetText 1000
    DataObj.PutInClipboard
    AppActivate "Cube Viewer: SERVER NAME->CUBE NAME->VIEW NAME"
    Application.SendKeys "^v"
    AppActivate Application.Caption
End Sub
If you use the clipboard in VBA, add a reference to Microsoft Forms 2.0 Object Library (see Tools > References, it's on top of the list usually)

or simply:

Code: Select all

Sub CopyToTM1()
    AppActivate "Cube Viewer: SERVER NAME->CUBE NAME->VIEW NAME"
    Application.SendKeys "1000"
    AppActivate Application.Caption
End Sub
Perhaps this could be useful in other programs than Excel?

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply