View Full Version : Help me please...
zach007
12-01-2005, 03:32 AM
Dear All Experts,
Has anyone could help me please. I create a debit / credit table in a word document using blank fields inside rows to be filled out on the VBA. The shymptom is like this, if I click each radio button (DEBIT) then it will write on each Field "DEBIT" on the word document, if I click on CREDIT radio button, it will write "CREDIT" or if I leave it blank, it will do nothing (result is a blank field). Anyone knows how to code this problem please...please...I was really stack to think about this..
Since this forum could not attach .DOC file, I can send to you the file to your whatever email addresses, etc for your reviews and helps...
Thank you very much for your fully kind assistance and helps...
Jennifer http://www.vbforums.com/images/smilies/wink.gif
lucas
12-01-2005, 09:17 AM
Hi Jennifer,
It would definitely help if you could upload your example. The problem is it must be zipped up. If you can't zip it up before attaching it to your post send me a private message and I will help you get it uploaded.
zach007
12-01-2005, 10:18 AM
Hi...Thanks for your kind helps...Please find my attached zipped file.
fumei
12-01-2005, 08:06 PM
This is easy to do. However, you need to be clear in WHAT you want to do. I have downloaded the file.
1. You have no event to actually show the UserForm. Something that will sactually display the userform. I have made it on Document_Open.
2. You have "radio" buttons. It is more accurate to call them Option buttons. Option buttons are most useful on a form if they are used as clear Yes/No Either/Or choices. If you put them in a frame, the user can ONLY pick one, or the other.
3. You have a listing of Credit - Debit on three lines - presumably to match the three fields in the document. You could in fact use only one pair.
4. You are using formfields in the table. I love formfields, but I have to ask why you are using them here. You could just as easily make the text in the cells "Credit" or "Debit". Formfields are not needed. Formfields are, generally, for user input. In this case, YOU are putting the text in the location. Unless you have a reason to, just use text rather than formfield.
5. Do not use the default names for objects. OptionButton1 tells you nothing.
6. It would help if you expand on your intentions. What are you trying to do?
You need to actually WRITE out your logic. You have six OptionButtons on your form. If OptionButton1 = True (it is picked)...what do you want to happen??? Should formfield("bookamrk1) be "Credit" or Debit"...or maybe it is formfields("bookmark2")...should IT be "Credit"...oh, maybe it should be "Debit". Or is it bookmark3...but is it "credit" or "Debit". You MUST write out EXACTLY what the logic is. What do you want to happen, and it has to be precisely, each little step. Programming will (generally) do exactly what you tell it to do. So if you do not tell it something, it will not do it, or if you tell it to do something you do not want - too bad - it will do what you tell it to do. It will NEVER do something you want it to do without you instructing it to do that. It will NEVER read your mind. That is what you need to map out precisely what you want.
To answer your direct question though:
If OptionButton1 = True Then _
ActiveDocument.Formfields("bookmark1").Result = "Debit"
But this is BAD programming.
fumei
12-01-2005, 08:10 PM
Hmmmm, I see another post. md seems to have discovered this is an assignment, although how did you do that?
He is correct. If this IS an assignment, we can not help you with a solution. Good thing I looked at the other post. I had actually quickly made it a lot better, and was going to post back. This I can't do now. We will help with guidance if you have a specific coding problem.
zach007
12-01-2005, 08:18 PM
Dear Gerry,
Thanks for your reply and helps.
I mean, I just create the dummy for your reviews....the shymtom is like this:
There is a debit radio button on the left side and credit on the right side, right?
If I click on debit side, it will write on the bookmarked field "DEBIT" text and in other side, if I click on credit side, it will overwrite the bookmarked field with "CREDIT"...
Do you know the code for this please? Please I need your help...
Dont worry about showing the form...
Thanks very much,
Jennifer
zach007
12-02-2005, 02:56 AM
Hi Gerry,
The meaning of assignment is not the assignment for university...my father give me task to do something with word documentation/template for his small shop...Please, just want to let you know..this is not the uni assignment...ok, I think I spell it wrong...hmm...ok, this my task from my father, I just want to help him to prepare his document...Please help me...
fumei
12-02-2005, 03:17 AM
Yes, I do know the code for this very well. I can do this in my sleep. But you know what....no, I will not help you. You must help yourself on this. I asked some questions, and I would have helped you, but I am very tired of trying to help people who do not answer questions, who ask the same question over and over agin, and really....do not seem to read posts very well.
I made suggestions, I asked serious questions to try and help you....but you obviously are not reading them. I even gave a line of code that would, in fact, write the text in as you asked.
You are looking for an easy solution without doing anything, either that or you are not really paying any attention to what I wrote. Why should I bother? I wrote a attentive response, and it sure seems you did not pay any attention to it.
So....no.
Good luck.
mdmackillop
12-02-2005, 04:04 AM
Anyone could help me please how to do this..???...I almost 2 weeks got stack about this....Please help me for my assignment.....
Hi Gerry,
This gave me a clue!
zach007
12-02-2005, 12:37 PM
What 's wrong with all of you guys...????....If this forum does provide helps...then just close this forum huh..???...I know you are an expert, but dont be underestimate me...I am a newbie, and I really dont know about that part only...the rest of project I had already made it...I already tried within 2 weeks for this codes but I was gave up...that is why I come to you guys....please be polite...I came here nicely...so be polite if someone asking and need helps...
Thanks..
zach007
12-02-2005, 05:48 PM
Hi MD,
Sorry I was little bit upset...however, thanks for continuing to help me...the file is in my father's office...so, I will send the whole codes on monday....I already try with your codes actually before you complaint to me BUT the field was gone. For Instance, if I clicked on radio button on "DEBIT" it wrote "DEBIT" but if I change to the CREDIT, the grey bookmark field was gone and it still kept "DEBIT"....I will send the file on Monday...I did the code like this:
If OptionDebit = True Then _
ActiveDocument.Formfields("bookmark1").Result = "Debit"
End If
If OptionCredit = True Then
ActiveDocument.Formfields("bookmark1").Result = "Credit"
EndIf
I know my codes are messy and were so BAD code design...because I am just learner and learner...I am really a new beginner...
Thanks,
Jennifer
fumei
12-02-2005, 09:07 PM
Send us the file. At least you are trying.
I would wish you to answer my questions. Something, or someone, told you to use formfields. Why? better yet - I ask again - what are you trying to do?
fumei
12-02-2005, 09:08 PM
Oh, and post ALL your code. The code posted above will not do anything in isolation. We need to see what you are doing. Don't be shy. We want to see what you are doing.
fumei
12-04-2005, 05:02 PM
I have a funny feeling this is going to fade away......
fumei
12-08-2005, 11:29 PM
Yeah....I thought so.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.