dcsimg
Results 1 to 8 of 8

Thread: Error 52: Bad File Name or Number Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2016
    Posts
    3

    Error 52: Bad File Name or Number Error

    I want to check if a File name already exist. my code works perfectly when i tested it with a local path name. But the hole will be saved in a sharepoint and the Pathname will be given as an URL. It will be like this: FullFileName: https://sec-ishare.infineon.com/site...201611010.pptm
    With a FullFileName like: C:\Users\... it works but with the other one i always get this error. (Bad File Name or Number)
    this is my code:

    OwnPathName = ActivePresentation.Path
    FullFileName = OwnPathName & "\" & NewFileName
    ' for debug only (can remove it later)
    'MsgBox OwnPathName
    'MsgBox FullFileName
    Dim StrFile As String
    Dim FileFound As Boolean
    FileFound = False
    'look for all types of PowerPoint files only (filter only to PowerPoint files to save time)
    StrFile = Dir(OwnPathName & "\*pptm*", vbHidden)
    MsgBox StrFile
    Do While Len(StrFile) > 0
    If InStr(StrFile, NewFileName) > 0 Then
    FileFound = True
    Exit Do
    End If
    StrFile = Dir
    Loop


    can you help me please solving this problem?
    Thanks in advance

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,596

    Re: Error 52: Bad File Name or Number Error

    The Dir() method does not work on URLs.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2016
    Posts
    3

    Re: Error 52: Bad File Name or Number Error

    How can i solve the problem? any suggestion??

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,596

    Re: Error 52: Bad File Name or Number Error

    I can only think of trying to download the file, if it succeeds then the file is available.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2016
    Posts
    3

    Re: Error 52: Bad File Name or Number Error

    Quote Originally Posted by Arnoutdv View Post
    I can only think of trying to download the file, if it succeeds then the file is available.
    There is many users and averything is in a sharepoint saved. that's the probleme :/

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,596

    Re: Error 52: Bad File Name or Number Error

    I don't understand what the problem is...

    See StackOverflow: http://stackoverflow.com/questions/1...harepoint-site

  7. #7
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Error 52: Bad File Name or Number Error

    I don't think he understands what "download the file" means.

    or how it's fundamentally different from copying the file through the file system.

    That StackOverflow link is about as simple as it gets.

  8. #8
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,596

    Re: Error 52: Bad File Name or Number Error

    Yes, but Dir() does only check if a file exists on a file system (or network share).
    I'm not aware of an equivalent for checking if an URL exists, beside downloading the content.

    Don't know what goal is of TS, just checking a single file, or building a list of available files.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width