мой макрос создает копию определенных страниц в документе. Затем я хочу сохранить эти страницы в каталоге SharePoint, но получаю
Ошибка времени выполнения '13 "Несоответствие типов".
Может кто-нибудь сказать мне, что не так с моим кодом? Я знаю, что моя ссылка верна. Мой путь неверен? Я хотел, чтобы активный do c сохранил путь к SharePoint. Любая помощь приветствуется!
Sub CopyPages()
Dim rCopy As Range
Dim rCurrent As Range
Dim sTemp As String
Dim i As Integer
Dim iStart As Integer
Dim iEnd As Integer
Set rCurrent = Selection.Range
' Get page numbers to be copied
sTemp = InputBox("Page range to copy (use format 6-7)", "")
i = InStr(sTemp, "-")
If i > 0 Then
iStart = Val(Left(sTemp, i - 1))
iEnd = Val(Mid(sTemp, i + 1))
If iStart < 1 Then iStart = 1
If iEnd < iStart Then iEnd = iStart
With ActiveDocument.Range
If iStart > .Information(wdNumberOfPagesInDocument) Then
iStart = .Information(wdNumberOfPagesInDocument)
End If
If iEnd > .Information(wdNumberOfPagesInDocument) Then
iEnd = .Information(wdNumberOfPagesInDocument)
End If
End With
' Set the range
Set rCopy = ActiveDocument.GoTo(What:=wdGoToPage, _
Which:=wdGoToAbsolute, Count:=iStart)
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, _
Count:=iEnd
rCopy.End = Selection.Bookmarks("\Page").Range.End
' Copy range to a new document
rCopy.Copy
Documents.Add
ActiveDocument.Range.PasteSpecial
'Selecting a location where you want your selection to save
ActiveDocument.SaveAs Path = "https://xxx.sharepoint.com/pm/xxx/TSCR%20Home%20Pages%20PM%20Documentation/Portal%20Designer"
rCurrent.Select
Else
If sTemp > "" Then
MsgBox "There is no dash character"
End If
End If
End Sub