473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

"Run time error '52': Bad file name or number"

1
Since my OwnPathName is as URL: https://sec-ishare.infineon.com/sites/MC_PM/Shared%20Documents/09_Reporting/PT/2016/
my code to check if the FileName exist doesn't work anymore and i always get the error message: "Run time error '52': Bad file name or number".
this is my code:


[Private Sub CommandButton21_Click()
Dim NewFileName As String
Dim OwnPathName As String
oldWeekDay = Weekday(Now)
Select Case oldWeekDay
Case 1
NewFileName = "PT PM Weekly " & Format(Date + 4, "yyyymmdd")
Case 2
NewFileName = "PT PM Weekly " & Format(Date + 3, "yyyymmdd")
Case 3
NewFileName = "PT PM Weekly " & Format(Date + 2, "yyyymmdd")
Case 4
NewFileName = "PT PM Weekly " & Format(Date + 1, "yyyymmdd")
Case 5
NewFileName = "PT PM Weekly " & Format(Date, "yyyymmdd")
Case 6
NewFileName = "PT PM Weekly " & Format(Date + 6, "yyyymmdd")
Case 7
NewFileName = "PT PM Weekly " & Format(Date + 5, "yyyymmdd")
End Select
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*")
Do While Len(StrFile) > 0
If InStr(StrFile, NewFileName) > 0 Then
FileFound = True
Exit Do
End If
StrFile = Dir
Loop
If FileFound Then
MsgBox "Modification already done"
Else
RemoveTextboxes
AllBlackAndDate
SaveAllPresentations (FullFileName)
End If
End Sub]
Can you help me please solving this problem
Nov 8 '16 #1
0 1065

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ron | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
1
by: Mohammed Sarwar | last post by:
Hi All, I am receiving the following message when I run Dts package which is creating a cube. Error Source : Microsoft Data transmission Services (DTS) Package Error Description: File name or...
0
by: simpsoro | last post by:
I am trying to run asp.net pages. The server is accessed by students via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and...
3
by: microsoft.news.com | last post by:
I have an app were i'm creating log files, but i want to give the log files a distinctative names such as Error_1/1/200512:30AM.log how can I get the date/time in the file name? I tried this...
4
by: Matthew Louden | last post by:
It happend to me more than once. When I create web controls or move the positions in VS.NET, I encountered the following run-time errors: It doesn't matter what controls I create, the following...
0
by: Ron Simpson | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
6
by: JAGster | last post by:
I don’t know VBA but have been using Access for awhile using tables, queries, forms and macros. I am trying to automate importing a number of Excel 2007 spreadsheets into an Access 2007 table. The...
0
by: sunny009 | last post by:
Hi, I am running a code to automate a report. Part of that automation is to go to share point site open up a file based on wild card section and follow on with the code. I am using DIR() to...
1
by: Sherrin | last post by:
The following works well in local share network drive. However, when the file is transfer over to the open network (view from internet), the following excel file will show error: Run-time error: 52....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.