Hi Jay,
> I have interpreted your code (probably incorrectly) as now when I click the
> OK button nothing happens the userform doesn't close, no folders are created
> and no error message appear. Where do I need to create the code? Do I need
> to add anything else. Sorry to be such a no brainer!!!
Not a problem, and not your fault. It's always difficult to know at what level a
poster is (unless they ask in the "Beginners" group, which you may not even see
through the interface you're using).
Remote trouble-shooting is always tricky, so I hope you don't mind taking this
step-by-step. Start by copying all your code to a document or text file, just in
case something goes wrong. you don't want to lose it :-)
In the code behind your UserForm, the _Click procedure for your OK button. Select
and comment out everything. The only active line of code should be
Me.Hide
In the procedure that displays the userForm, comment out everything and put in:
Dim frm As UserForm1 'Replace with Name of your Userform!!
Dim bValid As Boolean
Set frm = New UserForm1 'Replace with Name of your Userform!!
Do Until bValid = True
frm.Show
bValid = true
MsgBox "Hi there" '****
Loop
Unload frm
Run this procedure as a test. The UserForm should display. When you click OK it
should disappear, then the MsgBox should appear. If this works, as a further test,
substitute displaying text from a control on the UserForm for the message "Hi there"
(*****). For example:
MsgBox frm.cboDept.Value
Does all of that work, so far?
> > > I have created a macro which uses a userform to retrieve data to create a
> > > folder on the network. That works fine. I have added error check to see if
[quoted text clipped - 79 lines]
> > >
> > > End Sub
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :-)
JayM - 02 Feb 2006 10:49 GMT
Cindy
Thanks for your help. the step-bystep was great (and no I didn't realise
there was a beginners group)
I have carried out those steps and the first part works fine. unfortunately
trying to return a value from the cboDept doesn't - would this have something
to do with the fact that I also have a textbox (txtMyFolderName) on the same
form.
I will try and figure it out for myself but would be very grateful of any
help that you can offer.
JayM
> Hi Jay,
>
[quoted text clipped - 127 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply in
> the newsgroup and not by e-mail :-)
JayM - 02 Feb 2006 17:30 GMT
I have now got this working properly.
Any help with the next bit would be greatly appreciated
Thanks Jay
> Cindy
> Thanks for your help. the step-bystep was great (and no I didn't realise
[quoted text clipped - 140 lines]
> > This reply is posted in the Newsgroup; please post any follow question or reply in
> > the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 06 Feb 2006 10:11 GMT
Hi =?Utf-8?B?SmF5TQ==?=,
> unfortunately
> trying to return a value from the cboDept doesn't - would this have something
> to do with the fact that I also have a textbox (txtMyFolderName) on the same
> form.
No, that shouldn't make a difference.
Show us the macro code you've got now, and describe where the problem is
occurring? I just created a test form, with a combobox, and it's returning the
selection when I use the .Value property.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
JayM - 06 Feb 2006 13:09 GMT
Cindy
I am returning a value now. The problem was that I had frm.show twice in
the code.
Can you help with the next bit (what code to put where for the error
checking. (See your first post
Jay
> Hi =?Utf-8?B?SmF5TQ==?=,
>
[quoted text clipped - 16 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 08 Feb 2006 14:39 GMT
Hi =?Utf-8?B?SmF5TQ==?=,
> I am returning a value now. The problem was that I had frm.show twice in
> the code.
>
> Can you help with the next bit (what code to put where for the error
> checking. (See your first post
I'm sorry, I don't understand where you're stuck. I don't mention any error
checking in my first post... It would probably also help for you to post the
code as you now have it.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
JayM - 09 Feb 2006 07:28 GMT
Cindy
Here is my code so far. I am not sure what to put in the function part for
the error checking.
Jay
Sub frmFC()
Dim frm As frmFC
Dim bValid As Boolean
Set frm = New frmFC
Do Until bValid = True
frm.Show
bValid = CheckEntries(frm)
Loop
Unload frm
End Sub
Function CheckEntries(frm As frmFC) As Boolean
Dim bValid As Boolean
'Do error checking here
CheckEntries = bValid
End Function
> Hi =?Utf-8?B?SmF5TQ==?=,
>
[quoted text clipped - 15 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 28 Feb 2006 18:13 GMT
Hi Jay,
> Here is my code so far. I am not sure what to put in the function part for
> the error checking.
I keep going past this, hoping that my brain will figure out exactly what you
want. In your first message, you state
" I have added error check to see if the folder already exists and this works
fine."
So I can't figure out what it is you need, here? There's so much going on in
my brain, people really have to spell things out for me, I'm afraid...
You can read the information from the Userform by referencing frm.
If frm.txtInputXYZ = "abc" Then
will pick up the content of the textbox txtInputXYZ, for example. Is that
where you're stuck?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)