ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable to set Properties in Excel (https://www.excelbanter.com/excel-programming/277538-re-unable-set-properties-excel.html)

Jake Marx[_2_]

Unable to set Properties in Excel
 
Hi Ank,

You may want to try setting WindowState to -4143. That is the value of the
xlNormal constant, which is what the WindowState function is expecting.
Use -4137 for xlMaximized.

Also, you'll want to change xlApp to wApp when you uncomment the commented
lines of code.

--
Regards,

Jake Marx
MS MVP - Excel

Ank wrote:
Hi,

I am unable to set height, width, top or left property of Excel
application. I am trying to create an excel application, open a
spreadsheet and resize the excel application but resize doesn't seem
to work. The same properties work when creating word application.

the error that i get is "Unable to set XXX property of the application
class" of error # 1004.

I have looked all over the places without success. Please help!

Here's the snippet of the code:

Set wApp = CreateObject("Excel.Application")

'*Set it to normal
wApp.WindowState = 3

'*Resets the viewing properties of the word window.
wApp.Top = 0
' xlApp.Left = 0
' xlApp.Width = screen.Width
' xlApp.Height = 200

'Open the document now
wApp.Application.Workbooks.Open strDocName
wApp.ActiveWindow.WindowState = 2

wApp.Visible = True

thanks,
Ank




All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com