Results 1 to 5 of 5

Thread: Command to insert location once

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    3

    Cool 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

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    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?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    3

    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).

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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:
    1. Const Path = "G:\path\to\folder\"
    2.  
    3. 'or
    4.  
    5. Dim Path as String
    6. Path = "G:\path\to\folder"
    7.  
    8. '...
    9.  
    10. Selection.InsertFile Filename:= Path & "\filename.ext", Range:="", ...

    syntax may differ slightly depending on the language!

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    3

    Re: Command to insert location once

    Thank you for the quick respons.

    It praticcaly saves my day

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width