TheSwamp
Code Red => VB(A) => Topic started by: MSTG007 on September 24, 2013, 01:51:02 PM
-
I keep erroring out on this line. Any ideas?
Function GetPipeObjects()
' Function to set up the Civil 3D Pipe application, document and database object
' NOTE: use the pipe application to get the pipe settings
Dim oApp As AcadApplication
Set oApp = ThisDrawing.Application
Dim sAppName As String
sAppName = "AeccXUiPipe.AeccPipeApplication"
Set g_oCivilPipeApp = oApp.GetInterfaceObject(sAppName)
If g_oCivilPipeApp Is Nothing Then
MsgBox "Error creating " & sAppName & ", exit."
GetCivilObjects = False
Exit Function
End If
Set g_oAeccPipeDoc = g_oCivilPipeApp.ActiveDocument
Set g_oAeccPipeDb = g_oAeccPipeDoc.Database
End Function
Thanks for the help!
-
C3D2012 needs the version number passed with the AeccPipeApplication
sAppName = "AeccXUiPipe.AeccPipeApplication.9.0"
-
Jeff.
To be honest with you, I saw most of your post about this... I am really really thankful for your feed back. All Works as Expected.
-
Another fun question!
I have code that looks like the following:
Dim oExcelBook As Excel.Workbook
Dim dataNWPipeName As String
StartExcel
fileHHCalcs = "C:\P2X\storm.xls"
Set oExcelBook = g_oExcelApp.Workbooks.Open(fileHHCalcs) 'g_oExcelApp.Workbooks.Add
If oExcelBook Is Nothing Then
MsgBox "Error creating Excel document, exit."
Exit Sub
End If
' dictionary objects to hold column names and positions
Set dictPipe = New Dictionary
Set dictStructure = New Dictionary
'make a new sheet for structures
How can I specify what excel file to use rather than hard coding it?
-
You can ask the user for a string for the path, but that would mean they'd need to type it in. Or, better, use the OpenSave Class dialog to get the fie name & path. I've attached the Class code, here's a quick display of how to use it:
Dim cOpenSave As New OpenSaveClass
cOpenSave.MultiSelect = True
cOpenSave.Filter = "Text files (*.txt)|*.txt"
cOpenSave.Title = "Select File to Open"
cOpenSave.InitialDir = survPath
strFile = cOpenSave.ShowOpen
If strFile <> "" Then
-
Can you check your pm please?