Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-03-2018, 05:15 PM
jarnold231 jarnold231 is offline Opening Excel from Word Windows 10 Opening Excel from Word Office 2016
Novice
Opening Excel from Word
 
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
 

Tags
vba word



Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Excel from Word Opening word document from excel 2013 Aurelius Excel Programming 1 03-12-2017 01:47 PM
Opening Excel from Word Opening excel from word AXbean Word VBA 2 02-26-2017 12:59 AM
Opening Excel from Word Hyperlinks error msg on opening in Excel, Word matilda Excel 3 05-04-2015 07:06 AM
Opening Excel from Word Word Document Not Opening With Excel VBA JennEx Word VBA 3 06-20-2013 10:10 AM
Slow Opening Word and Excel files itoa Office 1 05-11-2009 02:01 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft