Continue to Site

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!

Open an Exel file(exel) and a Text file(txt) in Catia

Status
Not open for further replies.

tpalsl125

Automotive
Apr 24, 2015
44
DE
Code:
Sub CATMain()

Set objNote = CreateObject("Scripting.FileSystemObject"): 'objNote.Visible = true
Set objNotepad = objNote.OpenTextFiles.Open("D:\test.txt")

Set objExcel = CreateObject("Excel.Application"): objExcel.Visible = true
Set objWorkbook = objExcel.Workbooks.Open("D:\test.xls")

End Sub
Hello guys,

I made this script for opening an Exel file(xls) and a Text file(txt).

But it opens only Exel file not Text file.

How can I open a Text file in Catia like opening an Exel file?
 
Replies continue below

Recommended for you

Hi

Code:
' ======================================================
' Purpose: Macro will open a TXT file found in C:\Temp\ folder with NOTEPAD from an active CATIA session
' Usage:   1 - A CATIA session must be active 
'          2 - Run macro 
' Author: ferdo (Disclaimer: You use this code at your own risk) 
' ======================================================

Sub CATMain()

Dim objShell

Set objShell = CreateObject("WScript.Shell")

If MsgBox("Would you like to open the text file found in C:\Temp\testfile.txt?", vbYesNo) = vbYes then
   objShell.Run("notepad " & "C:\Temp\testfile.txt")
End If

End Sub

Regards
Fernando

- Romania
- EU
 
Thanks a lot!! Ferdo!!

That is what I want!!

I got the "opentextfile"is totally wrong.

You do save me!! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top