Google云端硬盘文件夹的动态路径

时间:2019-04-16 05:27:35

标签: excel vba

一个团队有一个xlsm文件,其中包含图形和“更新”按钮。团队成员单击“更新”后,ppt随即打开,其中嵌入了表格和图形。 存在两个问题:(1)文件应驻留在Google云端硬盘上-桌面Google云端硬盘文件夹的路径因用户而异; (2)不同的用户将使用不同的计算机-Windows或Mac,因此,反斜杠将发生变化。 当我意识到人们不会去宏来更改路径时,我在xls本身中添加了一行-“将路径插入ppt”,理论上,团队成员应该将路径粘贴到他的Google云端硬盘中,然后运行宏,保存ppt,它将自动保存在云中-参见MyPath行。甜?但是我得到的反馈是它太复杂了。您能想到允许xlsm触发ppt的任何方式吗?上传到Google云端硬盘?

我尝试了宏本身中的路径;然后,在xls本身中定义var。


'The script copy/pastes the table from the pg_3 sheet to ppt
    Dim PPApp As PowerPoint.Application, PPPres As PowerPoint.Presentation, PPSlide As PowerPoint.Slide

    Sheets("pg_3").Activate
    MyPath = Range("G1")
    Set PPApp = New PowerPoint.Application
    Set PPPres = PPApp.Presentations.Open(MyPath)
    PPApp.Visible = True
    Set PPSlide = PPPres.Slides(5)

    'Copying/Pasting the group of a chart & text
    Set CostDetails = ActiveSheet.Range("B13:C25")
    CostDetails.Copy
    PPSlide.Select
    Set PPTable = PPSlide.Shapes.Paste
    With PPTable
        .Left = 250
        .Top = 5
        '.Width = 471.2827
        .Height = 10
    End With

    'Copying/Pasting the group of a chart & text
    ActiveSheet.Shapes.Range(Array("Group 1")).Select
    Selection.Copy
    Set PPShape = PPPres.Slides(5).Shapes.Paste
    With PPShape
        .Top = 300
        .Height = 200
        .Left = 600
        .Width = 350
    End With

End Sub```

0 个答案:

没有答案