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
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