Need a hand with Deleting an existing Hyperlink...

Discussion in 'AutoCAD' started by arsnik91, Jul 11, 2003.

  1. arsnik91

    arsnik91 Guest

    Here's the problem, I wrote a routine to help in editing a Line Numbering block I use that includes a hyperlink. The routine works fine when editing a fresh block but when trying to update a block that has a hyperlink already assigned, it fails to update the link information. I need to delete the existing link I'm assuming but have not been able to do that. Can anyone point out what I assume to be missing please?





    Dim NewDesc As String
    Dim NewURL As String
    Dim LinkPart As String
    Dim Hyperlink As AcadHyperlink
    Dim Hyperlinks As AcadHyperlinks

    If objEnt.Hyperlinks.Count = 0 Then
    Array1(0).TextString = Get_Ent.TextBox1a.Text
    NewDesc = Get_Ent.TextBox1a.Text
    LinkPart = Right(NewDesc, 4)
    NewURL = "http://webapps/stuff/lineinfo.asp?line=" & LinkPart & "&/"
    Set Hyperlinks = objEnt.Hyperlinks
    Set Hyperlink = Hyperlinks.Add("Test")
    Hyperlink.URLDescription = NewDesc
    Hyperlink.URL = NewURL
    objEnt.Layer = "Line No"
    Else
    Array1(0).TextString = Get_Ent.TextBox1a.Text
    NewDesc = Get_Ent.TextBox1a.Text
    LinkPart = Right(NewDesc, 4)
    NewURL = "http://webapps/stuff/lineinfo.asp?line=" & LinkPart & "&/"
    Set Hyperlinks = objEnt.Hyperlinks
    Hyperlink.URLDescription = NewDesc
    Hyperlink.URL = NewURL
    objEnt.Layer = "Line No"
    End If
     
    arsnik91, Jul 11, 2003
    #1
  2. arsnik91

    Jeff Mishler Guest

    First, you don't set the hyperlink object in the Else statement. Second, you
    don't need to include all of the vars in BOTH the If and Else....set them
    first and then do the If..Else, like this (not tested):

    Dim NewDesc As String
    Dim NewURL As String
    Dim LinkPart As String
    Dim Hyperlink As AcadHyperlink
    Dim Hyperlinks As AcadHyperlinks

    Array1(0).TextString = Get_Ent.TextBox1a.Text
    NewDesc = Get_Ent.TextBox1a.Text
    LinkPart = Right(NewDesc, 4)
    NewURL = "http://webapps/stuff/lineinfo.asp?line=" & LinkPart & "&/"
    Set Hyperlinks = objEnt.Hyperlinks

    If Not Hyperlinks.Item("Test") Then
    Set Hyperlink = Hyperlinks.Add("Test")
    Else
    Set Hyperlink = Hyperlinks.Item("Test")
    End If

    Hyperlink.URLDescription = NewDesc
    Hyperlink.URL = NewURL
    objEnt.Layer = "Line No"


    HTH,

    Jeff

    block I use that includes a hyperlink. The routine works fine when editing a
    fresh block but when trying to update a block that has a hyperlink already
    assigned, it fails to update the link information. I need to delete the
    existing link I'm assuming but have not been able to do that. Can anyone
    point out what I assume to be missing please?
     
    Jeff Mishler, Jul 11, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.