Hi,
Have a hyperlink problem....the program i'm currently doing will take user text etc and insert a pre-made modelspace marker block in modelspace to indicate where the chosen layout is pointing to - it also should add a hyperlink to the chosen layout (to the marker block) so the user can jump to that layout..
It all works fine, just the hyperlink part, which i have now got to work sort of. After checking the hyperlink editor, the path, url and text to display all look like they should whenever you manually add a hyperlink to a layout - even on the Target or View of this Drawing page, its highlighting the correct layout, but instead of jumping to the layout, it will open up a Windows Explorer window to the drawing path directory..
If I open up the hyperlink editor, as i said it all looks fine, and for some reason if i click ok, then trying the link out again works this time, but only if i do that, otherwise it just opens up explorer..
Below is an extract of the program code. Can someone look at what could be wrong or let me know why the link won't 100% work..
Option Explicit
Dim response As Integer 'Yes/No..
Dim layoutX, layoutY As AcadLayout 'Acad Layout..
Dim layoutZ As String
Dim blockX As AcadBlockReference 'Inserted block..
Dim blockPoint As Variant ' Pick point for block insert..
Dim attribZ As Variant ' Attributes for inserted block..
Dim countx As Integer 'Counter for getting attributes..
Dim EntX As AcadEntity 'Acad Object (Block search for dblclick listbox)..
Dim Hyp As AcadHyperlink 'Add hyperlink to block..
Dim HypS As AcadHyperlinks 'Hyperlinks collection for block..
'********************************************
'************** INSERT BLOCK ****************
'********************************************
Private Sub insertmarkerBTN_Click()
' Check if all information is present..
If DetDesc1TXT.Text = "" Then
MsgBox "Please enter the main Detail title..", vbExclamation, "ModelSpace Detail Marker.."
Exit Sub
End If
' Check if all information is present..
If drawnumTXT.Text = "" Then
MsgBox "Please enter the main Drawing Number (or select it from the list)..", vbExclamation, "ModelSpace Detail Marker.."
Exit Sub
End If
ModelDetailRefFRM.Hide
ThisDrawing.ActiveSpace = acModelSpace
'Get pick point..
'Error Test for GetPoint method..
On Error Resume Next
TryAgainX:
blockPoint = ThisDrawing.Utility.GetPoint(, vbCr & "Pick the insertion point for the Detail Reference Marker.. ")
ErrHndlrX:
If Err.Number <> 0 Then
Err.Clear
GoTo TryAgainX
End If
On Error GoTo ErrHndlrX
'Insert block..
Set blockX = ThisDrawing.ModelSpace.InsertBlock(blockPoint, "X:\AbiCAD Blocks\General\Detail Reference - MSpace.dwg", 1#, 1#, 1#, 0)
blockX.Layer = "X-Notes"
' Get and edit attributes..
attribZ = blockX.GetAttributes ' Get Block attributes..
' Loop through attributes..
For countx = LBound(attribZ) To UBound(attribZ)
Select Case attribZ(countx).TagString
Case "DRAWING_NUMBER"
attribZ(countx).TextString = drawnumTXT.Text
Case "DETAIL_NUMBER"
attribZ(countx).TextString = detnumTXT.Text
Case "DETAIL_DESC_1"
attribZ(countx).TextString = DetDesc1TXT.Text
Case "DETAIL_DESC_2"
attribZ(countx).TextString = DetDesc2TXT.Text
End Select
Next countx
[color=red]' Add the Hyperlink to the block to link back to the Layout..
Set HypS = blockX.Hyperlinks
' Add a new Hyperlink complete with all properties
Set Hyp = HypS.Add(LayoutLIST.Text)
Hyp.URL = "#," & layoutZ
Hyp.URLNamedLocation = "," & layoutZ[/color]
blockX.Update
ModelDetailRefFRM.Show
End Sub
'********************************************
'************** INSERT BLOCK ****************
'********************************************
Any ideas?
Cheers,
Paul
basepointdesignzltd..
P4 3.0Ghz / 2GB RAM..
XP Pro SP2..
Sapphire X1950 512MB Dual-DVi Graphics Card..
AutoCAD 2008..