jcbrenn
Aerospace
- May 4, 2022
- 1
Hello all,
I need to write a CATIA macro that will open up an existing excel file from catia and export some data. I have pieces of code that do something similar (see the code below) but they open up new Excel and for this macro, I would like it to open a saved template every time. Any pointers are greatly appreciated!
I need to write a CATIA macro that will open up an existing excel file from catia and export some data. I have pieces of code that do something similar (see the code below) but they open up new Excel and for this macro, I would like it to open a saved template every time. Any pointers are greatly appreciated!
Code:
[/code
'Open up Excel Part'
Dim Excel As Object
On Error Resume Next
'if Excel is already running, then get the Excel object
Set Excel = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
'If Excel is not already running, then create a new session of Excel
Set Excel = CreateObject("Excel.Application")
Excel.Visible = True
Excel.Workbooks.Add
End If
'add a new workbook
'set the workbook as the active document
'Set WBK = Excel.ActiveWorkbook.Sheets(1)
Set WBK = Excel.ActiveWorkbook.Sheets("Sheet2")
]
[attach_link] [/attach_link]