AVAX-software.com Forums: AVAX ActiveX in VBA - Excel - AVAX-software.com Forums

Jump to content

Page 1 of 1

AVAX ActiveX in VBA - Excel

#1 User is offline   acarosio Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 09-April 08

Posted 09 April 2008 - 12:58 PM

Hi everyone

I'm trying to use this control, which seems to be quite good, on a VBA project running under Excel.
Just to see if it works as I need, I've written the following lines of code, were CACRQ is an Avax control.

Private Sub UserForm_Initialize()
    Dim ewsh As Excel.Worksheet
    Dim acdapp As New Application
    
    Dim x1() As Single, y1() As Single, z1() As Single
    Dim avxH As Long
    
    Set ewsh = ThisWorkbook.Sheets("Diseño Inserto")
    CACRQ.StartAvax
    ReDim x1(4), y1(4), z1(4)
    x1(1) = -0.5 * ewsh.Cells(92, 2): y1(1) = -0.5 * ewsh.Cells(91, 2): z1(1) = 0#
    x1(2) = 0.5 * ewsh.Cells(92, 2): y1(2) = -0.5 * ewsh.Cells(91, 2): z1(2) = 0#
    x1(3) = 0.5 * ewsh.Cells(92, 2): y1(3) = 0.5 * ewsh.Cells(91, 2): z1(3) = 0#
    x1(4) = -0.5 * ewsh.Cells(92, 2): y1(4) = 0.5 * ewsh.Cells(91, 2): z1(4) = 0#
    avxH = CACRQ.Add_PolyLine(x1, y1, z1, , 5, 1, , 1)
    CACRQ.Refresh
    
End Sub


When the form is closed, the following code is executed

Private Sub UserForm_Terminate()
    CACRQ.EndAvax
End Sub


The code runs, but the screen shows nothing but a sign saying that this is an unregistered version. Is it normal? Am I doing something wrong? Maybe the control does not run properly on VBA

Thanks

Alejandro Carosio

#2 User is offline   MUZAK Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 27
  • Joined: 04-December 07

Posted 09 April 2008 - 02:13 PM

I am using avax.ocx with VBA in Access quite successfully. Here's my start up code:

cAvax1.StartAvax

Call cAvax1.SetAvaxProperty(Avax.AvaxProp.SelectCursorHideOn_p, True)
Call cAvax1.SetAvaxProperty(Avax.AvaxProp.SelectEnabled_p, False)
Call cAvax1.SetBoundsAvax(-20, -20, 0, 60, 100, 0)
cAvax1.ScrollBars = 0
cAvax1.BackColor = Me.Detail.BackColor
Call cAvax1.DeleteAllItems
Call cAvax1.SetAvaxProperty(DXFCurveArcOn_p, True)
Answer = cAvax1.LoadFonts("\\10.1.25.200\server\AVAX.fnt")
Answer = cAvax1.LoadPalette("\\10.1.25.200\server\AVAX.pal")


I turnoff the cursor, ability to select, set the window size, turn off scroll bars, change color to blend in to form, etc....

Your issue may be with the line color your using, or viewport size (setbounds) I belive you can make setbounds dynmic based on drawing size. you just need to call it after you draw. The unregistered thing stays there unless you buy the control.

#3 User is offline   acarosio Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 09-April 08

Posted 09 April 2008 - 06:33 PM

Muzak

Thanks for your help. The issue was the drawing extents. The control works great. Is there any reference other than the *.RTF file included with the control?

Regards

Alejandro Carosio

#4 User is offline   MUZAK Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 27
  • Joined: 04-December 07

Posted 10 April 2008 - 05:26 AM

There is a .hlp file included in http://www.avax-soft...ax/avaxhelp.zip I use it alot!

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users