Here's the modified code:
{code}
Option Explicit ''ADDED
Sub Surface_Style()
Dim oAcadApp As AcadApplication
Dim g_oCivilApp As AeccApplication
Dim g_oDocument As AeccDocument
Dim g_oDatabase As AeccDatabase
Const sAppName = "AeccXUiLand.AeccApplication.8.0"
Set oAcadApp = ThisDrawing.Application
Set g_oCivilApp = oAcadApp.GetInterfaceObject(sAppName)
If (g_oCivilApp Is Nothing) Then
MsgBox "Error creating " & sAppName & ", exit."
''GetGlobalCivilObjects = False '''not needed
Exit Sub
End If
Set g_oDocument = g_oCivilApp.ActiveDocument
Set g_oDatabase = g_oDocument.Database
''GetGlobalCivilObjects = True '''not needed
Dim oSurface As AeccSurface
Dim Style_Count As Integer
Dim Style_List As String
Dim Surface_Name As String
Dim varPt As Variant ''ADDED
Dim i As Integer ''ADDED
ThisDrawing.Utility.GetEntity oSurface, varPt, "Pick Surface: "
Style_Count = g_oDocument.SurfaceStyles.Count
With ThisDrawing.Utility
.InitializeUserInput 1, "Proposed Existing Detailed Border Elevations Slopes Tin"
Surface_Name = .GetKeyword(vbCr & "Style Option [Proposed/Existing/Detailed/Border/Elevations/Slopes/Tin]: ")
End With
If Surface_Name = "Existing" Then
Surface_Name = "1' and 5' Background"
ElseIf Surface_Name = "Border" Then
Surface_Name = "Border Only"
ElseIf Surface_Name = "Detailed" Then
Surface_Name = "Detailed Grading (0.2')"
ElseIf Surface_Name = "Proposed" Then
Surface_Name = "1' and 5' Bold Design"
End If
For i = 0 To Style_Count - 1
If Surface_Name = g_oDocument.SurfaceStyles.Item(i).Name Then
oSurface.Style = g_oDocument.SurfaceStyles.Item(i)
End If
Next
End Sub
{code}