Bonjour,

Débutant en VBA, je souhaite convertir un fichier excel en pdf puis déposer ce fdp dans un site sharepoint 365.
J'ai réussi à faire ce que je voulais et ma macro fonctionnait bien tant que nous étions sous Sharepoint 2013.
Maintenant que nous avons migré vers 365, j'ai simplement mis à jour l'URL dans mon code, or, ça ne fonctionne plus.
J'obtiens un message d'erreur 76, chemin introuvable.
Mon code convertit la feuille excel en PDF puis l'enregistre en local. Ensuite, ça copie le pdf et colle dans le répertoire de destination (site sharepoint).
Pourriez-vous svp me dire où je me trompe?

Merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Sub PDFSP()
 
 
Dim wsA As Worksheet
Dim wbA As Workbook
Dim wrA As Range
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object
Dim team As String
'On Error GoTo errHandler
 
 
Set wbA = ActiveWorkbook
Set wsA = Sheets("Dashboard One Pager")
Set wrA = Range("ONEPAGER")
Set TeamReport = Range("C3")
 
strTime = Format(Now(), "yyyymmdd\_hhmm")
 
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
  strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"
 
'replace spaces and periods in sheet name
strName = Replace(wsA.Name, " ", "")
strName = Replace(strName, ".", "_")
fName = Range("c3").Value
 
'create default name for savng file
strFile = fName & "_" & strTime & ".pdf"
strPathFile = strPath & strFile
 
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
    (InitialFileName:=strPathFile, _
        FileFilter:="PDF Files (*.pdf), *.pdf", _
        Title:="Select Folder and FileName to save")
 
'export to PDF if a folder was selected
If myFile <> "False" Then
    wsA.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        Filename:=myFile, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False
 
End If
 
SharepointAddress = "//xxxx365.sharepoint.com/sites/xxxx/xxx/xxx/xxxx/xxx\"
Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(strPathFile) Then
FS.CopyFile strPathFile, SharepointAddress
 
End If
Set objNet = Nothing
Set FS = Nothing
 
 
MsgBox "Report has been successfully uploaded in the relevant location of Sharepoint"
 
End Sub