Produces the same 1004 windowstate error and highlights .Parent.WindowState = xlMaximized
Note that the spreadsheet opens maximised with or without the .Parent but this dialog box is behind it.
Hi Winshent, I agree that it looks like it could be a setup/config issue rather than a coding issue, I'll just have to keep looking.
As an aside, when I add in the Excel lib reference the spreadsheet will only open minimised regardless of code used.
thanks for your help.
Apologies, the error I get when running
Private Sub txtWorksPriceLink_Click()
Dim xlApp As Object
Dim xlBook As Object
Set xlApp = CreateObject("Excel.Application")
With xlApp
Set xlBook = .Workbooks.Open("Z:\" & Me.txtProjID & "\WorksPrice.xlsx")...
Hi, I've tried your code but get this error when it runs:
Compile Error: User -defined type not defined
And stops at this line:
Dim xlBook As Excel.Workbook
I've googled this error which suggested missing references, I've added DAO lib, ActiveX lib and Excel lib but it didn't...
Ok, I run this code:
Private Sub txtWorksPriceLink_Click()
Dim xlApp As Object
Dim wb As Object
Set xlApp = CreateObject("Excel.Application")
Set wb = xlApp.Workbooks.Open("Z:\" & Me.txtProjID & "\WorksPrice.xlsx")
xlApp.Visible = True
xlApp.Windowstate = xlMaximized
Set wb = Nothing
Set...
Here it is with WindowState
Private Sub txtWorksPriceLink_Click()
Dim xlApp As Object
Dim xlBook As Object
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("Z:\" & Me.txtProjID & "\WorksPrice.xlsx")
xlApp.Visible = True
xlApp.Windowstate = xlMaximized
Set...
Here's the code
Private Sub txtWorksPriceLink_Click()
Dim xlApp As Object
Dim xlBook As Object
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("Z:\" & Me.txtProjID & "\WorksPrice.xlsx")
xlApp.Visible = True
xlApp.Windowstate = xlMaximized
Set xlApp = Nothing...
This is the code
Private Sub txtWorksPriceLink_Click()
Dim xlApp As Object
Dim xlBook As Object
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("Z:\" & Me.txtProjID & "\WorksPrice.xlsx")
xlApp.Visible = True
Set xlApp.UserControl = True
Set xlApp = Nothing...
Thanks for your help guys but still no joy, when I try
xlApp.WindowState = xlMaximized Excel opens but with the following error:
Runtime error 1004 - Unable to windowstate property of the Application class.
When I say I want excel to open 'maximised' what I actually mean is I want it to open...
Hi, when opening an excel spreadsheet from a link on a form the spreadsheet opens in a minimised state. Adding this line of code fixes the problem and opens the spreadsheet with focus.
Set xlApp.UserControl = True However, when I close the spreadsheet there's an error message behind it - 424 -...
Ok, Left([PropertyID],9) returns characters 1-9
Right([PropertyID],3) returns 11-13
Can I concatenate the two strings which will return everything except the 10th character? Something like Left(([PropertyID],9),Right([PropertyID],3))