oseitutuSamuel
Board Regular
- Joined
- Jul 31, 2015
- Messages
- 82
Hi People,
I use the function below in Excel VBA to open different Word documents one at a time. I pass the Word document's name as a parameter to this function to open it.
Please kindly show me how I can write another code to close a document that is already opened before I open another one.
Many thanks:
Public Function FnOpenWordDoc(strWordDoc)
Dim wordApp As Word.Application
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (strWordDoc)
wordApp.Application.WindowState = wdWindowStateMaximize
wordApp.ActiveWindow.ActivePane.View.Zoom.Percentage = 100
wordApp.Visible = True
wordApp.Activate
End Function
I use the function below in Excel VBA to open different Word documents one at a time. I pass the Word document's name as a parameter to this function to open it.
Please kindly show me how I can write another code to close a document that is already opened before I open another one.
Many thanks:
Public Function FnOpenWordDoc(strWordDoc)
Dim wordApp As Word.Application
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (strWordDoc)
wordApp.Application.WindowState = wdWindowStateMaximize
wordApp.ActiveWindow.ActivePane.View.Zoom.Percentage = 100
wordApp.Visible = True
wordApp.Activate
End Function