Save Excel to the DXF folder

Save Excel to the DXF folder

Anonymous
Not applicable
402 Views
1 Reply
Message 1 of 2

Save Excel to the DXF folder

Anonymous
Not applicable

Hi

 

I've been using iLogic to read parameters from an excel fle. I have a dialog box that asks "Do you want to save DXF" which you use when the assembly looks like you intend it to look like. Then the rule saves all active components from the assembly to a folder named "Punching DXF" which is then used to feed the punching machine.

 

Anyway, I haven't found a way to save the excel file (a new instance of it) to the DXF folder so that the next job may begin (if the user forgets to do it manually). It's just a way to be sure that this was the excel used for any particular job.

 

If you guys have any idea please guide me.

 

P.S.

I found some answers about how to make a new excel file but I'm smply tryng to save the one I'm using to a new folder wth the job number as its name. 

0 Likes
Accepted solutions (1)
403 Views
1 Reply
Reply (1)
Message 2 of 2

Owner2229
Advisor
Advisor
Accepted solution

Hi, you can do it atleast by two ways.

 

First is opening the excel table and saving it under new name.

 

 

'first we define where we want to save it
Dim xPath As String = "C:\NewPath\TargetName.xlsx" excelApp = CreateObject("Excel.Application") excelApp.Visible = False excelApp.DisplayAlerts = false
' here define where to take the original table from
excelWorkbook = excelApp.Workbooks.Add(Template: = "C:\Parts\MyAwesomeExcelTable.xlsx")
' It can even use name and path of the assembly or part:

'ThisDoc.Path & "\" & ThisDoc.FileName(False) & ".xlsx" excelWorkbook.SaveAs(xPath) excelWorkbook.Close

 

Second is using file manager to simply copy the file without opening it (should be faster then).

 

Dim oFS As Object
oFS = CreateObject("Scripting.FileSystemObject")
Dim oFile As String
Dim oTarget As String
' First we define source file
oFile = "C:\Path\01.xlsx"
' And now target file
oTarget = "C:\NewPath\02.xlsx"
oFS.CopyFile( oFile, oTarget)
oFS = Nothing 

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes