Thread: Edit userform
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
lostthought[_4_] lostthought[_4_] is offline
external usenet poster
 
Posts: 1
Default Edit userform

Alright I have a program that when opened pulls up a userform. There i
a button on this form that allows you to edit the form. When thi
button is clicked the first form is unloaded and a new form comes up
This second form takes the data that you want and uses it to change th
data on the first form (well that's what I want it to do). I am usin
the following code to do this (change caption).

Dim VBC as object

Set VBC
Workbooks("3PUserFormTest.xls").VBProject.VBCompon ents("UserForm1")
VBC.Designer.Controls("ckwater").Caption = txNew

Problem: If I run it from the program window of the second form i
works fine, but if I close the program and reopen it so that the firs
form loads when I get to the second form and press okay so that it wil
run the above code it gives me an error. The error is as follows.

Run-time error '91':
Object Variable or With block variable not set

It highlights the last line of the above code, but I can't seem to fin
an error. I even placed the code into a different window and ran it b
itself. It worked fine. This has been stumping me all day. Pleas
help!

--
Message posted from http://www.ExcelForum.com