+ Reply to Thread
Results 1 to 7 of 7

on button click open textfile (from combobox1 choic - read url - goto url (relative path)

  1. #1
    Registered User
    Join Date
    07-24-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    69

    on button click open textfile (from combobox1 choic - read url - goto url (relative path)

    Hi all

    Im trying to make a relative path for the function below. My purpose is ,, by pressing commandbutton 13,, to open a textfile with url inside and then make IE go to that url. The textfile to open is choosen from what you choose in the combobox1 list. I must be close to solve it ..or maybe far away? Please look at following code. Why wont it work? :
    Please Login or Register  to view this content.
    Thanks in advance
    /Jan
    Last edited by Lkivagten; 08-03-2012 at 05:48 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hello Jan,

    It appears the file path is not correct because you have prefixed the file's path and name with the string "filepath". Try this correction...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-24-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hi Leith .

    thanks for your answer unfortunately the change you suggested didnt work.
    i get runtime error 53 file not found - although the filepathstring is correct ,, a textfile for choosen name in combobox1 excists in the data\url\ folder ?
    in debug mode this line is highlighted: Open filepath & ComboBox1.Value & ".txt" For Input As #FF
    Got an idea of what could be wrong?
    /Jan

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hello Jan,

    In my previous post the variable filepath is set to:
    Please Login or Register  to view this content.
    I understood the ComboBox contained the the file name. Does it contain a partial path also?

    The Open statement was changed to this...
    Please Login or Register  to view this content.
    Did I misunderstand what you posted?

  5. #5
    Registered User
    Join Date
    07-24-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hi Leith

    How great can one man be! Thanks - your changed code worked. I envy your capability to spot whats wrong and just correct it and then it works.
    You didnt misunderstand me - the combobox1 have a list of train stations and all these stations have a textfile associated with them - 1 station = 1 textfile (for url to google maps) .

    BUT im afraid i still have issues that i cant solve.. i worked with it for hours yesterday but couldnt get it to work. The thing is that im trying to make relative paths to all my functions (which all worked with the fixed paths) and its not that easy as i thought. I have one final thing i would like you to look at...
    When i select a station in combobox1 , i now get these things: i get a picture of the station shown in a little box (image2) ,, i can press a command button and get the picture shown full screen,, i can press commandbutton 13 to get the station shown in google maps (thanks to you) ,, and the final button (which i will ask you to look at) is "send picture to personel in a mail" . this function (in my old code with fixed path) would attach that picture of the choosen station (combobox1) to an email.. but after i have tried to make a relative path for the picture it doesnt work anymore.The mail opens and body and subject is fine but the attachment is gone with the wind. If you can figure this out.. could you tell me what i need to change but also why my! code didnt work? it would help me alot to understand and see the logic in vba a little better ( maybe )
    Thanks
    /Jan

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 08-02-2012 at 05:33 PM. Reason: Added Code Tags

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hello Jan,

    I can look at your code more in depth later. Somethings came up that need my attention. So, I won't be unavailable for the next 3 to 4 hours.

  7. #7
    Registered User
    Join Date
    07-24-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: on button click open textfile (from combobox1 choic - read url - goto url (relative pa

    Hi Leith

    Looking at my own code with fresh eyes turned out to be a good thing - i actually solved it myself and it was quite obvious what needed to be done. Strange i didnt see that before.

    Thanks for all your help so far. Here goes my change of code.

    Please Login or Register  to view this content.
    Last edited by Lkivagten; 08-03-2012 at 05:48 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1