+ Reply to Thread
Results 1 to 7 of 7

InStr Replace function problem - double entries

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    tirol
    MS-Off Ver
    Excel 2010
    Posts
    5

    InStr Replace function problem - double entries

    Dear Community

    I have got a simple VBA Code to list images in a certain directory and to get the image dimensions of each image.

    Some of the images within this folder are used as preview images. These are containing the german word "Voransicht" which means preview.

    I am using a foreach loop to get all images and then manipulate the filenames to get the name that I want.

    Please Login or Register  to view this content.
    Here is one example name: Beilagscheibe-Typ-A01-Voransicht.jpg

    As long as the preview images are containing the phrase "Voransicht" everything is working fine.



    Now I had to change the filenames a litte bit to the following: Beilagscheibe-Typ-A01-View-JPEG.jpg

    I tried to adapt the vba script to the following:

    Please Login or Register  to view this content.

    The problem is that it works the way it is supposed to but excel is listing the files 2 times. One time with "._" in front of the file name and one time the way it should be.

    ._Beilagscheibe-Typ-A01
    Beilagscheibe-Typ-A01

    Might there be a problem with string comparison with hyphens in it?

    Any help is very much appreciated.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: InStr Replace function problem - double entries

    did you copy the files from a mac at any time?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Can you post the rest of the code?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-29-2013
    Location
    tirol
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: InStr Replace function problem - double entries

    @JosephP: The images where created with Photoshop on a MAC.

    However if I manually rename the preview files to ...-Voransicht.jpg the script is working fine.


    @Norie: This is the whole Code:

    To be able to get dimensions of TIFF files etc. I included another library:LoadPictureGDI

    Please Login or Register  to view this content.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: InStr Replace function problem - double entries

    the files that begin with ._ are file fragments created by the mac

  6. #6
    Registered User
    Join Date
    04-29-2013
    Location
    tirol
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: InStr Replace function problem - double entries

    wow! you are so right!

    I coppied the files within the folder to a new folder and it works!

    Is there a way to remove the fragment files, although I am not seeing them?

    THANKS SO MUCH, was struggleing with that for days now!

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: InStr Replace function problem - double entries

    change your Explorer settings to show hidden files and folders

+ 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