Open DXF file from a button on the toolbar or userform is not working, Need help?
Hello my Name is Johnnydotcom and I use VBA to manipulate spreadsheet for manufacturing support.
I have a Simple Macro that i use to open files for a preview function, for example.
conditions met are:
The current cell in any spreadsheet is forced to cells that contain the correct information for the file name.
A userform is used to select the files location and sets that location in any spreadsheets H3 Range.
it starts the edrawings application, However, the file does not open.
I can explore the same location find the file and open the file without any problems.
The Immediate Window Shows the correct file name string.
here it is
Code:
Sub Open_DXF()
Dim pth As String, fName As String, CurVal As String
CurVal = ActiveCell.Value
pth = Range("H3").Value
fName = Dir(pth & "\*" & CurVal & "*.dxf")
'currently active to support trouble shooting
Debug.Print fName
If fName = "" Then
MsgBox ("File does not exist in this location")
Exit Sub
End If
ActiveWorkbook.FollowHyperlink pth & "" & fName
End Sub