-
Nov 9th, 2016, 05:23 AM
#1
Thread Starter
New Member
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
-
Nov 9th, 2016, 07:32 AM
#2
Re: Error 52: Bad File Name or Number Error
The Dir() method does not work on URLs.
-
Nov 9th, 2016, 07:47 AM
#3
Thread Starter
New Member
Re: Error 52: Bad File Name or Number Error
How can i solve the problem? any suggestion??
-
Nov 9th, 2016, 08:52 AM
#4
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.
-
Nov 9th, 2016, 09:07 AM
#5
Thread Starter
New Member
Re: Error 52: Bad File Name or Number Error
Originally Posted by Arnoutdv
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 :/
-
Nov 9th, 2016, 10:19 AM
#6
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
-
Nov 9th, 2016, 10:43 AM
#7
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.
-
Nov 9th, 2016, 10:58 AM
#8
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|