Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Error running simple command

I have the following function which generates "Object defined" error (please
correct for line wrapping):

Public Function LockWindowSize(argLock As Boolean)
If argLock = True Then ActiveWindow.EnableResize = False Else
ActiveWindow.EnableResize = True
End Function

Can someone fix this for me? I am attempting to disable the currently active
window from being resized. Thanks much in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Error running simple command

Hmmm...it works for me. How are you calling it?

Note that you can make it a bit shorter:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function


In article ,
quartz wrote:

I have the following function which generates "Object defined" error (please
correct for line wrapping):

Public Function LockWindowSize(argLock As Boolean)
If argLock = True Then ActiveWindow.EnableResize = False Else
ActiveWindow.EnableResize = True
End Function

Can someone fix this for me? I am attempting to disable the currently active
window from being resized. Thanks much in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Error running simple command

I switched to yours as follows:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function

I call it as follows: Call LockWindowSize(True)
That is all I have in a "Test" subroutine.

And I still get the error (Application defined or object defined error) and
the "ActiveWindow.EnableResize" line is highlighted.

Any ideas? I get the same error when running either from the VBE or from the
worksheet.


"JE McGimpsey" wrote:

Hmmm...it works for me. How are you calling it?

Note that you can make it a bit shorter:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function


In article ,
quartz wrote:

I have the following function which generates "Object defined" error (please
correct for line wrapping):

Public Function LockWindowSize(argLock As Boolean)
If argLock = True Then ActiveWindow.EnableResize = False Else
ActiveWindow.EnableResize = True
End Function

Can someone fix this for me? I am attempting to disable the currently active
window from being resized. Thanks much in advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error running simple command

I get that error if the Window is maximized. Make sure you window is not
maximized. (also, I assume the workbook is not protected).

--
Regards,
Tom Ogilvy


"quartz" wrote in message
...
I switched to yours as follows:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function

I call it as follows: Call LockWindowSize(True)
That is all I have in a "Test" subroutine.

And I still get the error (Application defined or object defined error)

and
the "ActiveWindow.EnableResize" line is highlighted.

Any ideas? I get the same error when running either from the VBE or from

the
worksheet.


"JE McGimpsey" wrote:

Hmmm...it works for me. How are you calling it?

Note that you can make it a bit shorter:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function


In article ,
quartz wrote:

I have the following function which generates "Object defined" error

(please
correct for line wrapping):

Public Function LockWindowSize(argLock As Boolean)
If argLock = True Then ActiveWindow.EnableResize = False Else
ActiveWindow.EnableResize = True
End Function

Can someone fix this for me? I am attempting to disable the currently

active
window from being resized. Thanks much in advance.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Error running simple command

That's it! Thanks!

"Tom Ogilvy" wrote:

I get that error if the Window is maximized. Make sure you window is not
maximized. (also, I assume the workbook is not protected).

--
Regards,
Tom Ogilvy


"quartz" wrote in message
...
I switched to yours as follows:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function

I call it as follows: Call LockWindowSize(True)
That is all I have in a "Test" subroutine.

And I still get the error (Application defined or object defined error)

and
the "ActiveWindow.EnableResize" line is highlighted.

Any ideas? I get the same error when running either from the VBE or from

the
worksheet.


"JE McGimpsey" wrote:

Hmmm...it works for me. How are you calling it?

Note that you can make it a bit shorter:

Public Function LockWindowSize(argLock As Boolean)
ActiveWindow.EnableResize = Not argLock
End Function


In article ,
quartz wrote:

I have the following function which generates "Object defined" error

(please
correct for line wrapping):

Public Function LockWindowSize(argLock As Boolean)
If argLock = True Then ActiveWindow.EnableResize = False Else
ActiveWindow.EnableResize = True
End Function

Can someone fix this for me? I am attempting to disable the currently

active
window from being resized. Thanks much in advance.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Error running simple command

Is the workbook protected?

In article ,
quartz wrote:

Any ideas? I get the same error when running either from the VBE or from the
worksheet.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Error running simple command

No, it was maximized...I assumed that the function would work with the window
in any state; I just modified it so that it changes the state to "Normal"
before attempting to lock it.

BTW, is it possible to do the same thing with the application window (as
opposed to the workbook)?

"JE McGimpsey" wrote:

Is the workbook protected?

In article ,
quartz wrote:

Any ideas? I get the same error when running either from the VBE or from the
worksheet.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple question on With command teepee[_3_] Excel Discussion (Misc queries) 2 December 26th 08 06:27 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Checking to see that a CHART exists prior to running a simple command Anton Excel Discussion (Misc queries) 0 August 29th 06 06:30 AM
Running windows command from a VB code saurabhb[_2_] Excel Programming 0 September 16th 04 12:55 PM
Running Multiple Modules With 1 Command Gary Excel Programming 2 January 31st 04 10:07 PM


All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"