Trying to open an Excel spreadsheet from Outlook and have it be visible after opening it. However, the file opens but I have to click on icon to make it visible.
Here is part of the VBA code that I use in Outlook:
------------
Pname = "C:\Users\" & Environ("Username") & "\Documents\Documents\"
Fname = "Words.xlsm"
On Error Resume Next
Set xlApp = GetObject("Excel.Application")
If Err.Number <> 0 Then
On Error GoTo 0
Set xlApp = CreateObject("Excel.Application")
End If
With xlApp
.Workbooks.Open Filename:=Pname & Fname, ReadOnly:=False
.ActiveWorkbook.Activate
.Visible = True
.WindowState = xlMaximized 'maximize Excel
.Application.ScreenUpdating = True
.Application.Run ("'Words.xlsm'!Words")
End With
------------
Here is part of the VBA code that I use in Outlook:
------------
Pname = "C:\Users\" & Environ("Username") & "\Documents\Documents\"
Fname = "Words.xlsm"
On Error Resume Next
Set xlApp = GetObject("Excel.Application")
If Err.Number <> 0 Then
On Error GoTo 0
Set xlApp = CreateObject("Excel.Application")
End If
With xlApp
.Workbooks.Open Filename:=Pname & Fname, ReadOnly:=False
.ActiveWorkbook.Activate
.Visible = True
.WindowState = xlMaximized 'maximize Excel
.Application.ScreenUpdating = True
.Application.Run ("'Words.xlsm'!Words")
End With
------------