Followhyperlink excel

supmktg

Registered User.
Local time
Today, 00:51
Joined
Mar 25, 2002
Messages
360
I have the following code behind a button to open a saved spreadsheet:

Code:
Private Sub cmdOpenExcel_Click()

FollowHyperlink "C:\ExcelReport.xls" 

End Sub

Excel opens and is maximized, but the spreadsheet is not maximized. How can I maximize the spreadsheet when it opens?

Thanks,

Sup
 
from what i gathered looking at the vba in excel. You would need something like this.

Private Sub cmdOpenExcel_Click()
Dim xlObj As New Excel.Application

FollowHyperlink "C:\ExcelReport.xls"
xlObj.ActiveWindow.WindowState = xlMaximized

End Sub

I think that might work for you.
 
cross5900,

I appreciate your suggestion, it worked after I added a line to Set the xlObj.
The working code is:

Private Sub cmdOpenExcel_Click()

FollowHyperlink "C:\ExcelReport.xls"

Dim xlObj As New Excel.Application
Set xlObj = GetObject(, "Excel.Application")
xlObj.ActiveWindow.WindowState = xlMaximized

End Sub

Thanks,
Sup
 

Users who are viewing this thread

Back
Top Bottom