View Single Post
 
Old 05-03-2018, 05:15 PM
jarnold231 jarnold231 is offline Windows 10 Office 2016
Novice
 
Join Date: May 2018
Posts: 2
jarnold231 is on a distinguished road
Default

I've added MS Excel Objects and it now works and opens the file, but only if specifically run rather than automatically. My code is currently as follows:

Code:
    

PrivateSub runOnOpen

    Call openExcel
    Call UpdateAllFields


End Sub

Sub openExcel()

  Dim excelApp As Excel.Application
  Dim openExcel As Workbook
  Dim var1 As Integer

  Set excelApp = New Excel.Application
  Set openExcel = excelApp.Workbooks.Open("filename")
  excelApp.Visible = True

End Sub

Sub UpdateAllFields()

    Application.DisplayAlerts = False
    ActiveDocument.Fields.Update
    Application.DisplayAlerts = True

End Sub
Reply With Quote