Onedrive业务同步后Excel到PDF转换不工作

Onedrive业务同步后Excel到PDF转换不工作,excel,vba,Excel,Vba,我使用下面的代码将Excel扩展名更改为pdf,并将文件保存到同一路径。在我的笔记本电脑中应用onedrive business sync后,宏开始不工作,并在if后跳过下面的代码。那么,有什么已知的解决方案吗 Set FSO = CreateObject("Scripting.FileSystemObject") s(0) = ThisWorkbook.FullName If FSO.FileExists(s(0)) Then s(

我使用下面的代码将Excel扩展名更改为pdf,并将文件保存到同一路径。在我的笔记本电脑中应用onedrive business sync后,宏开始不工作,并在if后跳过下面的代码。那么,有什么已知的解决方案吗

    Set FSO = CreateObject("Scripting.FileSystemObject")
    s(0) = ThisWorkbook.FullName

    If FSO.FileExists(s(0)) Then
        s(1) = FSO.GetExtensionName(s(0))
        If s(1) <> "" Then
            s(1) = "." & s(1)
            sNewFilePath = Replace(s(0), s(1), ".pdf")
                ActiveWorkbook.ExportAsFixedFormat _
                Type:=xlTypePDF, _
                FileName:=sNewFilePath, _
                Quality:=xlQualityStandard, IncludeDocProperties:=True, _
                IgnorePrintAreas:=False, OpenAfterPublish:=True
        End If
Set FSO=CreateObject(“Scripting.FileSystemObject”)
s(0)=ThisWorkbook.FullName
如果存在FSO.files(s(0)),则
s(1)=FSO.GetExtensionName(s(0))
如果s(1)“,则
第(1)款=“”&第(1)款
sNewFilePath=Replace(s(0),s(1),“.pdf”)
ActiveWorkbook.ExportAsFixedFormat_
类型:=xlTypePDF_
文件名:=sNewFilePath_
质量:=xlQualityStandard,IncludeDocProperties:=True_
IgnorePrintAreas:=False,OpenAfterPublish:=True
如果结束

s(0)失败时的值是多少?如果它指向http路径,则FSO无法检查该文件是否存在。@它将直接跳过If,并在结束If之后执行下一步。我在问如何替换这个公式。你能回答我的问题吗?@TimWilliams https:\\link也许可以看看方法