I have added a WindowsState line, as suggested by @Ralf_Meier, and it now works :-)
Imports Microsoft.Office.Interop.Word
Imports Microsoft.Office.Interop
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
Form3.TextBox1.Text = "Error, you have not entered a name for this Artist or Band ..."
Form3.TextBox2.Visible = False
Form3.Button2.Visible = True
Form3.AcceptButton = Button2
Form3.Show()
Exit Sub
End If
MusicFile = TextBox1.Text & ".docx"
If System.IO.File.Exists(MusicFolder & MusicFile) Then
Form3.TextBox1.Text = "Error, you already have an existing file for this Artist or Band ..."
Form3.TextBox2.Text = "Do you want to open that file or go back to the previous screen ?"
Form3.Button1.Visible = True
Form3.Button3.Visible = True
Form3.AcceptButton = Button1
Form3.Show()
Else
If SheetOrientation = "Portrait" Then
System.IO.File.Copy(MusicFolder & "Portrait.docx", MusicFolder & MusicFile)
End If
If SheetOrientation = "Landscape" Then
System.IO.File.Copy(MusicFolder & "Landscape.docx", MusicFolder & MusicFile)
End If
System.IO.File.SetAttributes(MusicFolder & MusicFile, fileAttributes:=vbNormal)
WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordDoc = WordApp.Documents.Add(MusicFolder & MusicFile)
Form1.WindowState = FormWindowState.Minimized <<< This line is added
Me.Close()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class