Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert and link part of excel sheet to CATIA V5 drawing

Status
Not open for further replies.

J23A02

Mechanical
Aug 9, 2016
1
US
Hi,

I am attempting to copy, paste and part of an excel sheet to a drawing sheet in CATIA V5 using a code in VBA excel. I have minimal experience programming but I know this would be more efficient than the current method used. This is what I have so far:

------------------------------------------------------------------------------------------------------------
Sub CATMain()

' CopyingaTable Macro

' Used to copy a table and insert to CATIA

' obtain the Catia Object

Dim CATIA As INFITF.Application
On Error Resume Next
Set CATIA = GetObject(, "CATIA.Application")
If Err.Number <> 0 Then
Set CATIA = CreateObject("CATIA.Application")
CATIA.Visible = True
End If
On Error GoTo 0

'active worksheet
Dim oWB As Excel.Workbook
Set oWB = Excel.ActiveWorkbook
Dim oSh As Excel.Worksheet
Set oSh = oWB.ActiveSheet

'Copying part of a worksheet

Dim rng As Range
Set rng = Application.InputBox("Select a range", "Obtain Range Object", Type:=8)

MsgBox "The cells selected were " & rng.Address

Range(rng.Address).Select
Selection.Copy

'opening a new drawing

Dim File As String
Dim ADoc As Document
File = CATIA.FileSelectionBox("File Open", ".CATDrawing", CatFileSelectionModeOpen)
If File <> "" Then Set ADoc = CATIA.Documents.Open(File)

'Creating a drawing table
Dim Insert As Action

End Sub
-----------------------------------------------------------------------------------------------------

Thanks for any help,
Jordan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top