[VBA] Error 424: Object Required

Can anyone please let me know why my code is not working?  I keep receiving Error 424:  Object Required.  I'm pretty new to VBA and coding so it might be something very simple.  This is what I would like my code to do:

  • There are text elements in a level.
  • The text content are numbers (1, 2, 3, 4, etc.).
  • I want to be able to select one text element, parse its content as a number and attach this number to a defined general URL.
  • The result should be attached to the selected element as URL link.

This is my code:

Sub Init()
  Dim oText As TextElement
  Set oText = ElementEnumerator.Current.AsTextElement
  Dim content As String
  content = oText.Text
  CreateLink content
End Sub
Sub CreateLink(ByVal content As String)
  Dim strURL As String
  strURL = "http://www.google.com" & "/" & content
  Debug.Print "My URL=" & strURL
  CadInputQueue.SendKeyin "ELEMENT CREATE LINK URL " & strURL
End Sub

Parents
  • Hi Jeff,

    Unknown said:
    I'm pretty new to VBA and coding

    The problem is not you are new to VBA, because we were (and for sure will be again) new to some topic ;-)

    But what is the problem is it seems you didn't pass any VBA learning, so you don't have basic knowledge how VBA works and how to create VBA apps, and you are trying to use MicroStation VBA, which adds another magnitude of complexity. In other worlds, you want to fly before you know how to walk.

    I asked you already in another thread and you have not answered it: Did you read Learning MicroStation VBA book? This is mandatory reading for anybody who wish to start with MicroStation VBA. It starts step by step from a ground, so it requires and expects only basic knowledge of VBA. It can make your coding effort much easier and will provide you answers for many your questions and problems.

    With regards,

      Jan

Reply
  • Hi Jeff,

    Unknown said:
    I'm pretty new to VBA and coding

    The problem is not you are new to VBA, because we were (and for sure will be again) new to some topic ;-)

    But what is the problem is it seems you didn't pass any VBA learning, so you don't have basic knowledge how VBA works and how to create VBA apps, and you are trying to use MicroStation VBA, which adds another magnitude of complexity. In other worlds, you want to fly before you know how to walk.

    I asked you already in another thread and you have not answered it: Did you read Learning MicroStation VBA book? This is mandatory reading for anybody who wish to start with MicroStation VBA. It starts step by step from a ground, so it requires and expects only basic knowledge of VBA. It can make your coding effort much easier and will provide you answers for many your questions and problems.

    With regards,

      Jan

Children
No Data