How to save a file with a different name by use parameter as the file name?

How to save a file with a different name by use parameter as the file name?

pong2474
Explorer Explorer
196 Views
1 Reply
Message 1 of 2

How to save a file with a different name by use parameter as the file name?

pong2474
Explorer
Explorer

How to save a file with a different name by use parameter as the file name?

 

file name ex) AAA-"LENGTH"-BBB → "LENGTH" 

0 Likes
197 Views
1 Reply
Reply (1)
Message 2 of 2

d_eckel
Contributor
Contributor

Hi, maybe something like this:

Dim oDoc As Document = ThisDoc.Document
Dim oMyParameter As UserParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters

'check file type and set dialog filter
Dim Filetype As String
If oDoc.DocumentType = kPartDocumentObject Then
    Filetype = ".ipt"
ElseIf oDoc.DocumentType = kAssemblyDocumentObject Then
    Filetype = ".iam"
ElseIf oDoc.DocumentType = kDrawingDocumentObject Then
    Filetype = ".idw"
End If

oDoc.SaveAs("C:\temp\" & oMyParameter.Item("SaveName").Value & Filetype, 0)

 with the user Paramter as a TextParameter:

d_eckel_0-1704866526524.png

I don't really understand the way qou want to name the file, described in the description.

If your Paramter is a number, you need the convert it from number to string with

CDblAny(oMyParameter.Item("SaveName").Value)

 in the last line.

 

I hope it helps you a little bit.

0 Likes