To all
I am trying to implement a "old" Excel macro I had to deal with .csv files directly in NX. In a nutshell the macro
1. Open a csv file
2. Copy specific data to another excel workbook
3. Close the csv file
4. Deal with next csv file in the list
As I need to convert some of the (excel macro) code, I am stumbling on the line
Workbooks.Open fileName:=sFileToProcess
which is not recognise . 'sFileToProcess' is the full name of the csv file (path +name) and exists (!)
The action is from within Excel: File/Open
Assuming that the .csv file is open, is there a way of using the 'ActiveSheet' option? The code I have is
Set shCSVSheet = ActiveSheet
as the .csv file is created by/from NX, the "activesheet" will have the name of the file
Thanks
Regards
JXB
RE: opening a .csv file
It seems that one always find a solution after one leaves the problem a side to do real work!. The following seems to do the job
Dim objExcel As Object
Dim objWBookCSVFile As Object 'The .csv file to deal with
objWBookCSVFile = objExcel.Workbooks.Open (FileName:=sFileToProcess, ReadOnly:=True)
' copy data
objWBookCSVFile.Close
Thanks
Regards