Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted

Create Text box x20 in VBA

I'm looking for a code to create x (5,10.....)numbers of Textboxes.

With  the ability to change parameters (Width and Hight)

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: Create Text box x20 in VBA

The code works for me. I have attached a qvw.

View solution in original post

4 Replies
mwoolf
Honored Contributor II

Re: Create Text box x20 in VBA

Maybe this will get you started:

sub test

  for i = 1 to 20

  set mytext = ActiveDocument.ActiveSheet.CreateTextObject

  strObjID = mytext.GetObjectID

  set fr = mytext.GetFrameDef

     pos = fr.Rect

     pos.Top = i*60

     pos.Left = i*60

  pos.Width = 60

  pos.Height = 90

     mytext.SetFrameDef fr

  ' strBkgColor =  BkgColor(strEventType)

  '     strBkgColor = "200,200,200"

  BGColorArray = Split(strBkgColor, ",", -1, 1)

  set prop = mytext.GetProperties

  prop.Layout.Text.v = strObjID

  ' prop.Layout.Frame.HelpText.v =strNewObjectID

  prop.Layout.BkgAlpha = 255  'Transparency 0%

  ' prop.Layout.BkgColor.PrimaryCol.Col = RGB(CInt(BGColorArray(0)),CInt(BGColorArray(1)),CInt(BGColorArray(2)))

  prop.Layout.TextColor.PrimaryCol.Col = RGB(0,0,0)

  prop.Layout.Frame.ZedLevel = 1

     prop.Layout.Frame.Show.Always = true

  prop.Layout.Frame.Show.Expression.v = 0

  prop.Layout.BottomMargin = 0

  prop.Layout.TopMargin = 0

  prop.Layout.LeftMargin = 0

  prop.Layout.RightMargin = 0

  mytext.SetProperties prop

  next

end sub

Re: Create Text box x20 in VBA

Thanks.

I'm getting error:

'Expected statement'

Capture.PNG

mwoolf
Honored Contributor II

Re: Create Text box x20 in VBA

The code works for me. I have attached a qvw.

View solution in original post

Re: Create Text box x20 in VBA

Thank you m w.

Silly mistake from my side:

Forgot the first sub line...