Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Excel variable for path  (Read 23344 times)

0 Members and 1 Guest are viewing this topic.

Esgrimidor

    Topic Starter


    Hopeful

    Thanked: 1
    Re: Excel variable for path
    « Reply #15 on: September 05, 2009, 03:31:03 PM »
    Alternatively, you could write a line to a text file & then start Excel and get it to read the file

    Code: [Select]
    Function TextFileLine() As String
    Dim MyString
    Open "c:\test.txt" For Input As #1
    Input #1, MyString
    Close #1
    TextFileLine = MyString
    End Function

    I think this is the best option. As you say the environtmental variable need reopen session and is not instantly recognized.

    At the present moment I am not able to discern if I am able to use this variable instantly in any other application like Goldmine - by example - , indicating the path in a bat file outside excel.

    Could I ?

    No dejes que tu felicidad dependa de lo que no depende de tí.

    Salmon Trout

    • Guest
    Re: Excel variable for path
    « Reply #16 on: September 05, 2009, 05:12:27 PM »
    indicating the path in a bat file outside excel.

    Could I ?




    Do you mean like this?

    Code: [Select]

    @echo off
    for /f "delims==" %%A in (' type "c:\test.txt" ') do (
        set variable=%%A
        )
    echo the value is %variable%


    Esgrimidor

      Topic Starter


      Hopeful

      Thanked: 1
      Re: Excel variable for path
      « Reply #17 on: September 07, 2009, 04:50:37 AM »
      I think we are near the point.

      I'm making consults for the permanency of the variables in the system.
      I think user's variables are in the system while you don't close session or reiniate. And environmental variables remain in the system after a close session or reiniate the system......

      Salmon, really is so simple that my problem is simply experiment with the variables. It's more quick or fast experiment than consult what will happen in every situation......

      I will no have an answer on my own meanwhile I don't touch the "variables" with my own fingers.......

      So.

      I will come back with the results

      Best Regards





      No dejes que tu felicidad dependa de lo que no depende de tí.

      Esgrimidor

        Topic Starter


        Hopeful

        Thanked: 1
        Re: Excel variable for path
        « Reply #18 on: September 14, 2009, 05:05:56 PM »
        I used the command SET

        SET varexpediente=125.09 to observ in

        MyPC -- properties - advanced options - environmental variables .

        But I don't see the variable. The bat executed was :

        echo off
        set varexpediente=125.09

        So the variable is not created this way.....

        Or only exist during the execution of the bat file. .......

        No dejes que tu felicidad dependa de lo que no depende de tí.

        Salmon Trout

        • Guest
        Re: Excel variable for path
        « Reply #19 on: September 15, 2009, 12:09:57 AM »
        Or only exist during the execution of the bat file. .......

        Exactly

        Esgrimidor

          Topic Starter


          Hopeful

          Thanked: 1
          Re: Excel variable for path
          « Reply #20 on: September 15, 2009, 12:58:27 AM »
          So Salmon Trout :

          There is any way to create an environmental variable with a script ?

          Perhaps a way to modify an environmental variable with a script ?

          No dejes que tu felicidad dependa de lo que no depende de tí.

          Salmon Trout

          • Guest

          Esgrimidor

            Topic Starter


            Hopeful

            Thanked: 1
            Re: Excel variable for path
            « Reply #22 on: September 15, 2009, 08:40:21 AM »
            I go flying.

            I left for you a photo of my mountain :

            No dejes que tu felicidad dependa de lo que no depende de tí.

            Salmon Trout

            • Guest
            Re: Excel variable for path
            « Reply #23 on: September 15, 2009, 09:18:05 AM »
            Gracias por la montana. Jo me gusta mucho los españoles y las españolas y sus montanas y sus peliculas y los canciones de Amaral y Pagina 2 (Oscar Lopez) y el brandy Carlos III

            Esgrimidor

              Topic Starter


              Hopeful

              Thanked: 1
              Re: Excel variable for path
              « Reply #24 on: September 15, 2009, 10:58:12 AM »
              Tú sí que sabes. Estoy mirando los enlaces y son muy buenos

              *****

              You are a gourmet. I am looking the links and are very interesting. There are many ways, even with reg files, and the setx option link seems to be for windows 2000, but I think I have seen for xp too.

              Have a nice day.
              No dejes que tu felicidad dependa de lo que no depende de tí.

              Salmon Trout

              • Guest
              Re: Excel variable for path
              « Reply #25 on: September 15, 2009, 11:35:22 AM »
              You very kindly did not correct my Spanish; I think I should have written me gustan las cosas como las canciones de Amaral (y me gustan mucho sus piernas también). Although setx is nominally in Windows 2000 Resource Kit it will work with XP, Server 2003 & 2008 and Vista, and Windows 7 - so will the other Resource Kit utilities.

              I also like las peliculas y actores sudamericanos / sudamericanas ... Ricardo Darin, Inés Efron, etc


              Esgrimidor

                Topic Starter


                Hopeful

                Thanked: 1
                Re: Excel variable for path
                « Reply #26 on: September 15, 2009, 12:13:01 PM »
                You very kindly did not correct my Spanish; I think I should have written me gustan las cosas como las canciones de Amaral (y me gustan mucho sus piernas también). Although setx is nominally in Windows 2000 Resource Kit it will work with XP, Server 2003 & 2008 and Vista, and Windows 7 - so will the other Resource Kit utilities.

                I also like las peliculas y actores sudamericanos / sudamericanas ... Ricardo Darin, Inés Efron, etc



                As you wish :

                The prior phrases :

                All perfect

                The present phrase :

                All perfect

                But If you like you can improve. I am read in a Readers club (in spanish of course)

                In a few weeks I'll read On Chesill Beach by Ian McEwan .....

                Gracias por la foto de la montaña. Me gusta mucho España , sus montañas, su cine , las canciones de Amaral y Oscar López) y el brandy Carlos III. De Amaral además me gustan mucho sus piernas : largas, esculturales, muy atractivas. Creo que la tendría conmigo toda una tarde aprendiendo informática mientras ella me canta sus bonitas melodías.


                Ultimamente he visto una película de Luis Buñuel : Ensayo de un crimen . Maravillosa. Te la recomiendo.

                ******
                Recently I've seen a Luis Buñuel movie : An assasin trial . Simply wonderful. recommended.

                Edited : http://www.imdb.com/title/tt0048037/

                You can get on the web.

                Looking for the last version of "La Tregua" by Benedetti I discovered an uncomplicated comedy : Carlos, siete mujeres y un homosexual. It's not a good movie, but is a pleasant time and Adriana have good legs. A mexican movie.

                Edited : http://www.imdb.com/title/tt0395429/

                From Spain I recommended Garci and the movie "Ninette" with Elsa Pataky. Splendid legs. All splendid. A wonderful comedy for all times with spanish people in the old Paris.

                Edited : http://www.imdb.com/title/tt0442371/

                If you have any problem gettings this films tell me. I'll help you.



                No dejes que tu felicidad dependa de lo que no depende de tí.

                Esgrimidor

                  Topic Starter


                  Hopeful

                  Thanked: 1
                  Re: Excel variable for path
                  « Reply #27 on: September 21, 2009, 07:48:14 PM »

                  Do you mean like this?

                  Code: [Select]

                  @echo off
                  for /f "delims==" %%A in (' type "c:\test.txt" ') do (
                      set variable=%%A
                      )
                  echo the value is %variable%



                  I can try this ?

                  @echo off & setlocal ENABLEEXTENSIONS
                  set "first="
                  for /f "delims=" %%a in ('more ^< numbers.txt') do (
                    if not defined first set first=%%a
                  )
                  echo/%first%

                  in my case :

                  @echo off & setlocal ENABLEEXTENSIONS
                  set "first="
                  for /f "delims=" %%a in ('more ^< Y:\GABINETE/PROYECTOS/MODELOS/CONTROL\MiControl.txt') do (
                    if not defined first set first=%%a
                  )
                  echo/%first%

                  The value will be the value of varexpediente, because is the first line in the MiControl.txt

                  I suppose the variable is %first%


                  How can I do the bat for launch word and open by a predefined bookmark ?

                  I suppose ..... :


                  entrarenworddeposicionvariableporunmarc ador.bat

                  @echo off & setlocal ENABLEEXTENSIONS
                  set "first="
                  for /f "delims=" %%a in ('more ^< Y:\GABINETE/PROYECTOS/MODELOS/CONTROL\MiControl.txt') do (
                    if not defined first set first=%%a
                  )
                  rem "%programfiles%\Microsoft Office\Office10\WINWORD.EXE" /t "Y:\GABINETE\PROYECTOS\%varexpediente%\%varexpediente%.Proyecto.doc" /mmacro3
                  "%programfiles%\Microsoft Office\Office10\WINWORD.EXE" /t "Y:\GABINETE\PROYECTOS\%first%\%first%.Proyecto.doc" /mmacro3


                  Note : Really I am made a mess with the actualization of the variable varexpediente, because now i don't get actualize the value. I am going to close the session and retry...

                  No dejes que tu felicidad dependa de lo que no depende de tí.

                  Esgrimidor

                    Topic Starter


                    Hopeful

                    Thanked: 1
                    Re: Excel variable for path
                    « Reply #28 on: September 21, 2009, 08:17:51 PM »
                    Alternatively, you could write a line to a text file & then start Excel and get it to read the file

                    Code: [Select]
                    Function TextFileLine() As String
                    Dim MyString
                    Open "c:\test.txt" For Input As #1
                    Input #1, MyString
                    Close #1
                    TextFileLine = MyString
                    End Function

                    I am trying this, but I obtain error....

                    Sub Auto_Open()
                    Function TextFileLine() As String
                    Dim MyString
                    Open "c:\test.txt" For Input As #1
                    Input #1, MyString
                    Close #1
                    TextFileLine = MyString
                    End Function
                    End Sub



                    No dejes que tu felicidad dependa de lo que no depende de tí.

                    Salmon Trout

                    • Guest
                    Re: Excel variable for path
                    « Reply #29 on: September 22, 2009, 12:19:35 AM »
                    =
                    « Last Edit: September 22, 2009, 12:51:14 AM by Salmon Trout »