Command to insert location once
Hey,
At work we are "programming" some reports (in know its very basic). We use 1word-file (thats empty) and dépending of the result we insert a different kind of file (negatif, positive etc).
Now everytime i use Inerstfile,..., G:\...\Name of the file
I used that command for more then 50 times (cause there are many different reports)...
So the day that i change the reports of plave i have to change at least 50 lines.
So thats why I wanted to know if their exists a code that i can use, in the beginning of my script, so when i change the location of my reports i just have to change that line once and not at every insertfile that i use.
I hope somebody can help ;)
Greetz
Re: Command to insert location once
I'm not sure what you are referring to! Do you mean and easier way to insert the report name into the report?
Re: Command to insert location once
This i a small part.
...
Case "Cases"
Select Case NAT
Case "Result"
Selection.InsertFile FileName:= _
"G:\test\test\test\For us\filename.dot", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False (1)
End Select
...
Depending de cases and the results we enter a different kind of file. You have to know that at work we have a big network where we have just a small part for us. We can't choose the directory etc. That means that when its operational and other departments gone use our file they gone have to change at least 40 times the section
G:\test\test\test\...\ Filename.dot
Now i was curious if its possible to enter something thats replaces G:\test\test\test\... by a word and that somewhere else that word is defined with G:\test\test\test\....
So that we just have to change one line instead of every entry (1).
Re: Command to insert location once
that would be called a variable or constant. is this VB, or VBScript, or..?
you should be able to do something like:
vb Code:
Const Path = "G:\path\to\folder\"
'or
Dim Path as String
Path = "G:\path\to\folder"
'...
Selection.InsertFile Filename:= Path & "\filename.ext", Range:="", ...
syntax may differ slightly depending on the language!
Re: Command to insert location once
Thank you for the quick respons. :thumb:
It praticcaly saves my day ;)