VBA save file with name

VBA save file with name

sam
Advocate Advocate
736 Views
2 Replies
Message 1 of 3

VBA save file with name

sam
Advocate
Advocate

Hi, 

On my VBA form I have inbox where I can paste a folder location. 

Capture003.PNG

I have following code in my form rule that takes this string and saves the file.

strInputLocation = oLocation.Value
strBeamName = strInputLocation & "Part " & BoxName & ".ipt"
oDoc.SaveAs strBeamName, True
oDoc.Close True

 

Now file is saving alright, but there is problem with the location and file name.  Expected part name is Part 9.ipt inside New folder but it is saving in a higher level folder "box " adding New folder to the file name. (New folderPart 9.ipt). see below. 

 

Capture004.PNG

 

any idea what is wrong. 

Best regards, 

sam

0 Likes
Accepted solutions (1)
737 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor
Accepted solution

@sam 

I think you're just missing a backslash...

 

strBeamName = strInputLocation & "Part " & BoxName & ".ipt"

 

should be:

 

strBeamName = strInputLocation & "\" & "Part " & BoxName & ".ipt"

Message 3 of 3

sam
Advocate
Advocate

@JhoelForshav  Thank you so much for quick and helpful reply. have a good day. 🙂