Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Run - Time error

I didn't think you were using the Load statement. This, as
you're aware, loads but does not show the UF and lets you
manipulate it in the Initialize event.

My assumption is that the Show statement both loads and
shows a UF. Therefore, the Show statement creates a
redundacy (since you have already loaded it) which causes
the error. In the Auto_Open code, you can simply state
UserForm1.Show and forget the Load statement. Also, remove
the Show statement in the Initialize code. This works.

Regards,
Greg

-----Original Message-----
I did as you suggested, now my UserForm will not

display. I have an
auto_open macro which is suppose to open the

UserForm when the workbook
opens (Load UserForm1)


"Greg Wilson" wrote

in message
...
Simply remove the Show statement. You must already be
using the Show statement in a separate module to call

the
UF. When it initializes, your code tells it to show

itself
again even though it is already called. This causes the
error; however, you must close the UF before the error
message can display because the UF has priority.

Regards,
Greg


-----Original Message-----
The code below does what I need it to do (displays the

current date in a
textbox when userform1 opens) but when I close the

Userform I get the
following error:

Run-time error '91':
object variable or with block variable not set


Private Sub UserForm_Initialize()
With UserForm1
.DateTextBox.Text = Format(Date, "dddd dd-mmm-

yy")
.Show
End With
End Sub


.



.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Run - Time error

Thanks for your help. I thought I had to load the userform.


"Greg Wilson" wrote in message
...
I didn't think you were using the Load statement. This, as
you're aware, loads but does not show the UF and lets you
manipulate it in the Initialize event.

My assumption is that the Show statement both loads and
shows a UF. Therefore, the Show statement creates a
redundacy (since you have already loaded it) which causes
the error. In the Auto_Open code, you can simply state
UserForm1.Show and forget the Load statement. Also, remove
the Show statement in the Initialize code. This works.

Regards,
Greg

-----Original Message-----
I did as you suggested, now my UserForm will not

display. I have an
auto_open macro which is suppose to open the

UserForm when the workbook
opens (Load UserForm1)


"Greg Wilson" wrote

in message
...
Simply remove the Show statement. You must already be
using the Show statement in a separate module to call

the
UF. When it initializes, your code tells it to show

itself
again even though it is already called. This causes the
error; however, you must close the UF before the error
message can display because the UF has priority.

Regards,
Greg


-----Original Message-----
The code below does what I need it to do (displays the
current date in a
textbox when userform1 opens) but when I close the
Userform I get the
following error:

Run-time error '91':
object variable or with block variable not set


Private Sub UserForm_Initialize()
With UserForm1
.DateTextBox.Text = Format(Date, "dddd dd-mmm-

yy")
.Show
End With
End Sub


.



.



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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Run-time error '11' & Run-time error '1004' Piers Clinton-Tarestad Excel Programming 0 January 9th 04 08:35 PM
Run-time error '11' & Run-time error '1004' Piers Clinton-Tarestad Excel Programming 0 January 9th 04 07:45 PM


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

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"