PDA

View Full Version : access to word



casual-rich
04-07-2009, 06:45 AM
hi a friend of mine who is doing the same assignment has given me some code to transfer data from Access to Word

private sub command_click ()
Dim obj word as object

set obj - create object (class; "word.app")
obj word.documents add my documents/uniwork 08-9
obj word. visible.true

obj word.active document bookmarks
exists ("name") = true then
obj word. active document. bookmarks ("name")
range.text = customer name.value

is this the right code?

fumei
04-07-2009, 08:19 AM
No.

casual-rich
04-07-2009, 08:20 AM
No.

ok can i ask for some advice on which is the right code then? please

fumei
04-07-2009, 08:28 AM
This sounds like a school/homework assignment. If it is, please ask your teacher for some assistance.

I would also suggest using Help. I would also suggest doing even a rudimentary search of the internet.

Every single line has incorrect syntax.

Dim obj word as object (wrong syntax)
set obj - create object (class; "word.app") (wrong syntax)
obj word.documents add my documents/uniwork 08-9 (wrong syntax)
obj word. visible.true (wrong syntax)

obj word.active document bookmarks
exists ("name") = true then (wrong syntax)
obj word. active document. bookmarks ("name")
range.text = customer name.value (wrong syntax)

Just as an example:

obj word.active document bookmarks
exists ("name") = true then

1. incorrect spacing
2. incorrect use of the dot (.) - or lack there of
3. incorrect use of a line break (no underscore character)
4. incorrect syntax for an If...Then logic statement.

The last one is particularly bad.

Are you using Option Explicit in your code modue? if not, I strongly suggest start using it.

casual-rich
04-07-2009, 08:30 AM
This sounds like a school/homework assignment. If it is, please ask your teacher for some assistance.

I would also suggest using Help. I would also suggest doing even a rudimentary search of the internet.

Virtually every line has incorrect syntax.

Dim obj word as object (wrong syntax)
set obj - create object (class; "word.app") (wrong syntax)
obj word.documents add my documents/uniwork 08-9 (wrong syntax)
obj word. visible.true (wrong syntax)

obj word.active document bookmarks
exists ("name") = true then
obj word. active document. bookmarks ("name")
range.text = customer name.value

well it is not homework it is an assignment and the lecture is on holiday for two weeks now as it is easter and i have looked on the internet and i cannot find much can you point me in the right direction please

fumei
04-07-2009, 08:42 AM
An assignment? What does that mean? Who assigned it?

What does "the lecture is on holiday" mean? A lecture is an event, not a person. As far as I know, events do not go on holidays.

You have looked on the internet? OK, I'll bite. WHAT did you look for? Be specific. Tell me - EXACTLY - what you used for your search...the actual words you used.

After that, I can probably suggest some (perhaps) better words to look for. Heck, I just did a search myself and got literally THOUSANDS of places - some with actual useable code to transfer data from Access to Word.

We will be happy to help if you ask specific questions.

Actually, it is true...you DID ask a specific question.

"is this the right code?"

I gave you a specific answer.



No.

casual-rich
04-07-2009, 08:45 AM
An assignment? What does that mean? Who assigned it?

What does "the lecture is on holiday" mean? A lecture is an event, not a person. As far as I know, events do not go on holidays.

You have looked on the internet? OK, I'll bite. WHAT did you look for? Be specific. Tell me - EXACTLY - what you used for your search...the actual words you used.

After that, I can probably suggest some (perhaps) better words to look for. Heck, I just did a search myself and got literally THOUSANDS of places - some with actual useable code to transfer data from Access to Word.

ok firstly let me really really really honest with you ok i have dyslexia (quite bad in fact) so taking the mickey out of my spelling doesn't help but i do like that your trying to help me- i searched for VBA Access to word

fumei
04-07-2009, 09:00 AM
Good heavens. I just searched using "VBA Access to Word" and founds lots and lots and lots and lots of sites with real working code.

I am sorry to hear you have severe dyslexia. I understand that this makes things difficult for you. I will try and be understanding of this. However, YOU have to do some work. No one here is going to do your work for you.

By the way, it is a very good idea to answer direct questions when asked of you. I asked about this "assignment". You did not answer. That makes me think you are avoiding answering.

I am also assuming that you meant to write lecturer - not lecture. Fair enough. Except...that still means a school/course assignment. I for one, will NOT hand over any code for a course assignment. I will help with specific questions.

casual-rich
04-07-2009, 09:03 AM
YES IT IS AN ASSIGNMENT AND YES I HAVE TRIED TO HELP WITH THE CODE THAT I HAVE PROVIDED AND IM NOT ASKING FOR PEOPLE TO DO MY WORK AND I WOULD LIKE SOME HELP WITH TRTING TO FIND THE RIGHT CODE FOR IT TO WORK

IS THAT A CRIME?

fumei
04-07-2009, 10:11 AM
A crime? Absolutely not, but as you have used full caps which is universally considered rude and shouting...PLUS I have been trying to help, and you are not doing anything to help yourself...I will simply say bye-bye and good luck.

I will flatly say it appears that you have not tried anything. Saying you have is simply not true. I used your own search words and found lots and lots of sites that give examples of how to do what you are asking. If you can not bother to use them, why should I do anything? This is not a Help Desk. We are here to assist people who are trying to do thing themselves. You are doing nothing.

You are - in fact - trying to get people to do your work.

I will say it again. Using YOUR search words I found lots of sites with actual code that will help you get things going.

I even gave you a specific hint and example about what is wrong with your code.


Just as an example:

obj word.active document bookmarks
exists ("name") = true then

1. incorrect spacing
2. incorrect use of the dot (.) - or lack there of
3. incorrect use of a line break (no underscore character)
4. incorrect syntax for an If...Then logic statement.


You neither responded, nor asked for any clarification. If you had bothered to ask any reasonable question...oh, like:

"what IS the correct syntax for an If...Then statement?"

I would have given you a direct answer explaining what it is. As I stated, I will help with specific questions.

The fact that you can not even bother to try is 100% your responsibility and in my mind demonstrates laziness. You did not even TRY. You did not bother to even try to get more information. I offered to help with specific questions - again, say, what IS the correct syntax? - and you asked nothing. I would have told you, but you did not even try.

Good luck with your assignment. I think you going to need it. Maybe someone else here will try and help you, but the fact you shouted like that...I will not.

fumei
04-07-2009, 10:30 AM
Oh I wish I had looked at what you have posted before. I just took a look at your other posts, and how you have responded.

I would never have even bothered to give to you ANY response at all. You do not deserve any help whatsoever. You are rude and have not even tried to use any of the help other people have previously given you. You have learned nothing. There is even good examples of what is basically wrong with the code you posted in THIS thread...and you appeared to have paid no attention whatsoever.

I retract wishing good luck with your assignment. You deserve to fail it.

casual-rich
04-08-2009, 02:38 AM
Oh I wish I had looked at what you have posted before. I just took a look at your other posts, and how you have responded.

I would never have even bothered to give to you ANY response at all. You do not deserve any help whatsoever. You are rude and have not even tried to use any of the help other people have previously given you. You have learned nothing. There is even good examples of what is basically wrong with the code you posted in THIS thread...and you appeared to have paid no attention whatsoever.

I retract wishing good luck with your assignment. You deserve to fail it.

HAHAHA WELL ACTULLY IM ON TRACK TO GET A 2:1 SO **** IT AS I HAVE FOUND OUT HOW TO DO IT WITH BEEN UP ALL NIGHT

fumei
04-08-2009, 11:11 AM
Finally. That is what you should have done in the first place...do it yourself, even if it takes all night. That is we all do it.

Hopefully you will not be graded on being able to write.

mdmackillop
04-15-2009, 02:39 PM
Abusive language will not be tolerated. Your questions all appear to relate to obtaining code for your assignments, another breach or our rules.