I am trying to use VBA to open a specific word document when I click on a button in my excel spreadsheet. I want to actually go into the document. I then want to change the size of the window to "Restore Down". Essentially the word window should be the size of a popup box. When I run the VBA, I am only sometimes taken to the word document. The rest of the time the Word Icon just shows up on my windows menu bar and flashes. My VBA in Word does absolutely nothing. I have displayed my Word and Excel VBA below.
My VBA in Excel
Private Sub CommandButton3_Click()
Set wordapp = CreateObject("word.Application")
wordapp.documents.Open "C:\Users\rossy\OneDrive\Work In Progress\Payroll and Billing
Spreadsheet\Newest 148\Code\1.docx"
wordapp.Visible = True
wordapp.Application.Activate
End Sub
My VBA In Word
Private Sub Document_Open()
With Application
.WindowState = wdWindowStateNormal
.Resize Width:=InchesToPoints(5), Height:=InchesToPoints(5)
End With
End Sub