+ Reply to Thread
Results 1 to 15 of 15

Text/Image loader

  1. #1
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Text/Image loader

    Hi to everybody again.


    I need again your help for a one macro driving me crazy.

    I try to explain you better as i can.

    I need a macro that load from a folder a specific file text(.txt) and then load the txt content in the sheet work. But no all the content just a one part. A one column

    Only the first one column of the text.

    You can see an example here.
    All the file text are the same like this.

    http://img504.imageshack.us/img504/9918/examplez.jpg

    I need that the macro load only the numbers code list from the file in the worksheet. (inside the red circle)

    Also inside a one combo box it's ok.


    All the rest of the file txt must be ignored.


    Then, when the numbers list of the first column its loaded in the sheet or in the combobox, i need that when i select a one number code from this column. In a one image box control, the macro load a one image from a one folder. The image name its the same name of the number code and its a .jpg file.


    I hope i dont ask too much. Thank you in advance.

    I attach here a one original txt file i hope can be useful, its in japanese but dont get scary i need just the first numbers column.
    Last edited by Aikuchi; 08-06-2009 at 12:28 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: Text/Image loader

    This will read the example file.

    Please Login or Register  to view this content.
    There are examples of loading images to controls on the forum, search for Loadpicture.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Thank you so much Andy San.

    It's absolutely perfect.

    Only a one thing, because i have to use this macro for load different txt, with different name's it's possible to connect this macro with a button and when i press this button i can chose the txt file.
    Or if it's easier to script, write the txt file name(of a one targeted folder) in a cell and automatically load the txt. (Like for the macro of the images you helped me yesterday).

    Thank you again.

    Shigemi.
    Last edited by Aikuchi; 08-04-2009 at 11:12 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: Text/Image loader

    check out the use of

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Quote Originally Posted by Andy Pope View Post
    check out the use of

    Please Login or Register  to view this content.
    Absolutely perfect Andy San Thank you so much.

    Now i try to find the macro for load the picture for each cell value of the sheet 1.

    Shigemi.

  6. #6
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Quote Originally Posted by Andy Pope View Post
    check out the use of

    Please Login or Register  to view this content.
    Andy San i copied this line code in the macro code, and when i start the macro the window for the open file works perfectely, but also if i chose to load a different txt, the macro load always the file txt Sappo.txt.

    Probabily i have to change those lines?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: Text/Image loader

    Did you check the help or search the forum?

    code would be more like

    untested
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Ok i worked a little for the image loading, and this is the macro for load the txt and load the image:

    Please Login or Register  to view this content.
    Take look the red row please, the macro work but load only the picture of cell A1, i need indeed that load one picture for each cell of the column A i select, from A1 to An(A1000)


    ____________________________________________

    Please Login or Register  to view this content.


    Thank you Andy San, i tried to put this code in the macro, but doesn't work. For sure it's a my error, i copy the code in the wrong way.

    Thank you.

    Shigemi.
    Last edited by Aikuchi; 08-04-2009 at 12:43 PM.

  9. #9
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Somebody can help me for fix the last code?

    Thank You

    Shigemi


    Edit:

    I wanna also use a macro that delete all the column from the column cell A2 Awhen i don't need anymore.

    But doesn't work good. Erase all the column A and B

    Please Login or Register  to view this content.

    Edit 2: I fixed the macro for open different txt files, i just need a fix for open each image for each cell value of the column A and the fix for the column A delete.


    Thank you

    Shigemi
    Last edited by Aikuchi; 08-04-2009 at 11:04 PM.

  10. #10
    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: Text/Image loader

    Hello Shigemi San,

    I have made a workbook that puts the picture files into ComboBox. The user Double Clicks the box to select the text file from which the ComboBox is loaded. Tell me if this is close to what you want.
    Attached Files Attached Files
    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!)

  11. #11
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Quote Originally Posted by Leith Ross View Post
    Hello Shigemi San,

    I have made a workbook that puts the picture files into ComboBox. The user Double Clicks the box to select the text file from which the ComboBox is loaded. Tell me if this is close to what you want.
    Thank you always for your help Leith San.

    I tried your script but doesn't work.

    When i try to load a one txt file there is always the message: "File was Empty or No Data was Matched"

    And anyway i need that load only a one column from the file, and after from this column, for each cell value load a one image.

    Here i attach a one example of what i mean.
    I attach also the txt file.

    Please Login or Register  to view this content.

    Edit

    All the numbers from the txt files start with the number 0. Es: 045213. But when the macro load the list numbers in the column A, the cells automatically erase the first number 0. Like: 45213. Its possible to respect exactly the format of the numbers? And when the macro load the numbers list inside the cells there is also the first number 0.

    Thank you.
    Last edited by Aikuchi; 08-06-2009 at 03:11 AM.

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: Text/Image loader

    The modification uses the getopenfilename and formats the data as text so the leading zero is retained

    Please Login or Register  to view this content.

  13. #13
    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: Text/Image loader

    Hello Shigemi San,

    Domo arigatou gouzaimasu. The text file helped me fix the errors. It works now. Please let me know if anything needs to be changed. The workbook is attached.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Quote Originally Posted by Leith Ross View Post
    Hello Shigemi San,

    Domo arigatou gouzaimasu. The text file helped me fix the errors. It works now. Please let me know if anything needs to be changed. The workbook is attached.

    Leith San Ohayou gozaimasu.

    You are my hero its awesome, perfect

    Just a one thing please, sumimasen!

    Now the macro works that get the images from the list only if the file txt and the image are in the same folder.

    Its possible to target the folder of the images where the combobox must do the check for the files?

    And then force the image control box for every image at the same dimension of 320 x 200.


    Thank you alway Leith San, Thank you so much also to you Andy San.

    Shigemi.


    Edit: I resolved the problem of the image box dimension changing the Autosize value in False.
    Last edited by Aikuchi; 08-05-2009 at 10:53 PM.

  15. #15
    Registered User
    Join Date
    08-02-2009
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Text/Image loader

    Ok I fixed also the picture path by myself.

    Thanks to you im learning vba!

    Have a nice day Leith San and Andy San

    Shigemi.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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