从Sharepoint下载模板,保存,关闭它,然后通过保存它的文件夹打开它

时间:2015-12-15 11:40:32

标签: access-vba ms-access-2007

我在sharepoint上的模板并下载它们。我希望它首先保存在我的桌面E.G.然后关闭文件,然后从桌面打开文件,然后从那里做所有事情。

我目前的代码如下:

Public Function CH05_Generate()

Dim WordApp As Word.Application
Dim Doc As Word.Document
Dim WordPath As String

WordPath = "Path to the sharepoint"

Set WordApp = CreateObject("Word.Application")
Set Doc = WordApp.Documents.Add(WordPath)

With Doc
    .FormFields("text").Result = Forms![TD-E-PM200-CH05]!Kommentar
    .FormFields("S3").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q1
    .FormFields("S4").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q2
    .FormFields("S5").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q3
    .FormFields("S6").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q4
    .FormFields("S7").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q5
    .FormFields("S8").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q6
    .FormFields("S9").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q7
    .FormFields("S10").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q8
    .FormFields("S11").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q9
    .FormFields("S12").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q10
    .FormFields("S13").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q11
    .FormFields("S14").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q12
    .FormFields("S15").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q13
    .FormFields("S16").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q14
    .FormFields("S17").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q15
    .FormFields("S18").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q16
    .FormFields("S19").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q17
    .FormFields("S20").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q18
    .FormFields("S21").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q19
    .FormFields("S22").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q20
    .FormFields("S23").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q21
    .FormFields("S24").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q22
    .FormFields("S25").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q23
    .FormFields("S26").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q24
    .FormFields("S27").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q25
    .FormFields("S28").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q26
    .FormFields("S29").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q27
    .FormFields("S30").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q28
    .FormFields("S31").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q29
    .FormFields("S32").Result = Forms![TD-E-PM200-CH05]!sub.Form!Q30
    .FormFields("S33").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q31
    .FormFields("S34").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q32
    .FormFields("S35").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q33
    .FormFields("S36").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q34
    .FormFields("S37").CheckBox.Value = Forms![TD-E-PM200-CH05]!sub.Form!Q35
End With

WordApp.visible = True
WordApp.Activate
WordApp.ActiveDocument.Protect wdAllowOnlyFormFields, True

End Function

所以我希望所有.FormFields都在我桌面上打开的文件中完成,而不是Sharepoint。

0 个答案:

没有答案