Code to Create Directory problem

M

Maperalia

I have a statement that save as a file with the description typed in the cell
"C1" (see code below). However. I need to save it under a new directory with
the same name. Unfortunately, the code is creating the directory only and no
the file.
Could you please tell me what I am doing wrong?

Thanks in advance.
Maperalia

'**** Start Save as the Part **************************
'Sub SaveAs()
Dim WO As String
Dim Progname As String

Set swApp = Application.SldWorks
Set swApp = GetObject("SldWorks.Application")
Set Part = swApp.ActiveDoc

WO = Worksheets("Test").Range("C1")
MkDir "C:\Top\" & Format(Sheets("Test").Range("C1").Value)
Directory = Format(Sheets("Test").Range("C1").Value)
longstatus = Part.SaveAs3("C:\Top\" & Directory & " \ " & WO & ".sldprt", 0,
2)
'End Sub
'**** End Save as the Part **************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top