質問編集履歴

1

ソースの途中に出てくる関数ConvertPathのコードを追加しました。

2022/10/13 01:05

投稿

nao-y
nao-y

スコア26

test CHANGED
File without changes
test CHANGED
@@ -48,5 +48,35 @@
48
48
  If strFname <> "False" Then
49
49
  ActiveSheet.Range("$C$3").Value = strFname
50
50
  End If
51
+
52
+ ~~~~~~~~~~~~~~~~~~~~~~
53
+ Function ConvertPath(str As String, FSO As Object) As String
54
+ On Error Resume Next
55
+ If InStr(str, "/Documents") Then
56
+ str = Right(str, Len(str) - InStr(str, "/Documents") - Len("/Documents") + 1)
57
+ str = Replace(str, "/", "\")
58
+ str = Environ("OneDrive") & str
59
+ End If
60
+ If InStr(str, "https:") Then
61
+ If InStr(str, "?csf") Then
62
+ str = Left(str, InStr(str, ".com/") + Len(".com/") - 2) _
63
+ & Mid(str, InStr(str, "/site"), InStrRev(str, "?csf") - InStr(str, "/site"))
64
+ Else
65
+ str = Left(str, InStr(str, ".com/") + Len(".com/") - 2) _
66
+ & Mid(str, InStr(str, "/site"), Len(str) - InStr(str, "/site") + 1)
67
+ End If
68
+ str = Replace(str, "https:", "")
69
+ str = Replace(str, ".com", ".com@SSL\DavWWWRoot")
70
+ str = Replace(str, "/", "\")
71
+ With CreateObject("ScriptControl")
72
+ .Language = "JScript"
73
+ str = .CodeObject.decodeURI(str)
74
+ End With
75
+ End If
76
+ If FSO.GetExtensionName(str) = "" And Right(str, 1) <> "\" And Right(str, 1) <> "/" Then
77
+ str = str & "\"
78
+ End If
79
+ ConvertPath = str
80
+ End Function
51
81
  ------
52
82