Target Folder

Target Folder

CGVJM6DF
Enthusiast Enthusiast
159 Views
2 Replies
Message 1 of 3

Target Folder

CGVJM6DF
Enthusiast
Enthusiast

Hello,

 

I try to do an external rule, which will be used by different users.

How can I do this line:

Dim targetFolder As String
targetFolder = "C:\Users\Cgv\Documents"

Where "Cgv" it is me. But I want each user to have the file in their "Documents"

0 Likes
160 Views
2 Replies
Replies (2)
Message 2 of 3

FINET_Laurent
Advisor
Advisor

Hi,

 

Can you try this line and give us feedback ?

MsgBox(My.Computer.FileSystem.SpecialDirectories.MyDocuments)

 

Thank you and kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 3 of 3

Jacob__with__a__k
Enthusiast
Enthusiast

@CGVJM6DF 

to get the username from the Inventor Application options use this line:

myName = ThisApplication.GeneralOptions.UserName

 

to get the Username from the current Windows user: use code below

WSHnet = CreateObject("WScript.Network")
UserName = WSHnet.UserName
UserDomain = WSHnet.UserDomain
objUser = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
'get user name
UserFullName = objUser.FullName
'remove space and replace with dot
oDotUserName = Replace(UserFullName," ",".")

'return both variations
MessageBox.Show( "Full User Name: " & vbCrLf & UserFullName & vbCrLf & oDotUserName, "iLogic")

and this works fine as well

MsgBox(My.Computer.FileSystem.SpecialDirectories.MyDocuments)

it works fine when I test it, @FINET_Laurent, but not sure what will happen when you have multiple userfolders on the same pc

0 Likes