Runtime Error 438
We recently upgraded Visio to a 2010 version from a 1998 version because of incompatibility issues with Office 2010 and windows 7. The following code used to draw an electric diagram for our technicians, but since the upgrade now gives a runtime error 438.
Private Sub cmdPwrDwg_Click()
Dim pwrFile As String
Dim myFile As String
Dim tShape As Excel.Shape
If Not Dir(shtSettings.Range("B1").Value) = "" Then
pwrFile = shtSettings.Range("B1").Value & "Power Diagram.vst"
If Me.cmdPwrDwg.Enabled = True Then
shtDrawing.Activate
If wrkElect.curDwg Is Nothing Then
If wrkElect.dwgShape Is Nothing Then
For Each tShape In shtDrawing.Shapes
If tShape.Name = "PwrDwg" Then
Set wrkElect.dwgShape = tShape
Exit For
End If
Next tShape
If wrkElect.dwgShape Is Nothing Then
If Not Dir(pwrFile) = "" Then
Set wrkElect.dwgShape = shtDrawing.Shapes.AddOLEObject(, pwrFile)
wrkElect.dwgShape.Name = "PwrDwg"
wrkElect.dwgShape.Line.Visible = msoFalse
Else
MsgBox "Power Template Unavailable." & vbNewLine & _
"Check", vbOKOnly
End If
End If
End If
wrkElect.dwgShape.OLEFormat.Activate
Set wrkElect.curDwg = wrkElect.dwgShape.OLEFormat.Object.Object.Document
Set wrkElect.appVisio = wrkElect.curDwg.Application
End If
End If
Else
MsgBox "Power Template Unavailable.", vbOKOnly
End If
If Not wrkElect.curDwg Is Nothing Then
cmeTest = wrkElect.cmeUpdate
shtDrawing.Range("A1").Activate
shtInput.Activate
End If
End Sub
Any help would be greatly appreciated
Thanks
Recent comments
5 years 42 weeks ago
6 years 28 weeks ago
6 years 40 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 49 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago