?
Solved

Result of DDE-Search in Word

Posted on 1997-12-22
17
Medium Priority
?
327 Views
Last Modified: 2006-11-17
I am using Access 2.0 and Word 6.0.
From Access I opened a document via DDE in Word. Now I am able to search within the word-document via DDE. But I can't figure out how I can get back the result of the search, e.g. if the string was found or not.
(I am using a german version, so if you have the commands in german, write them, if not, I will try to translate :-) )
0
Comment
Question by:BBC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
17 Comments
 
LVL 4

Expert Comment

by:ozphil
ID: 1963470
If you can be converted to OLE automation, you can make your code much simpler, more powerful and more maintainable. and you can decimate the DDE code.

are you interested?


0
 
LVL 1

Author Comment

by:BBC
ID: 1963471
SURE! I never did this ... gimme a "kick-off" please.
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963472
ok. code coming.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 4

Accepted Solution

by:
ozphil earned 450 total points
ID: 1963473
ill lock the question in the meatime...:)
0
 
LVL 1

Author Comment

by:BBC
ID: 1963474
waitin ... :-)
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963475
Ive taken this from another similar exercise. Try this to get a feel for it, then use these principles to carry out your task.
meanwhile ill take a look at the search function.

I would not use DDE but OLE automation instead.

It is 1000 times simpler, more robust, more maintainable.

Try this bit of code, it will work on whatever version of Word is on the system, and the activation and management of word is all taken care of by OLE - you mainly concentrate on coding the word tasks you want to perform

Sub wordoperate ()
Dim wrd As Object

Set wrd = CreateObject("word.basic")
wrd.fileopen "c:\myfile.xyz" 'BBC put any filename of your own here
wrd.insert "this is a test"
wrd.filenew
wrd.insert "how easy is this? :)"
wrd.FileSaveAs ("c:\temp\testwrd.doc")

Set wrd = Nothing
End Sub

now have a look at testwrd.doc to examine the results.
0
 
LVL 1

Author Comment

by:BBC
ID: 1963476
testing ...
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963477
To develop your code, use the macro recorder in Word to get a clue as to what functions are used by word, then  copy these over to Access, prefixing with the appropriate object owner.

Using this approach i found that  EditFind is the function used by Word to search.

Looking up help i found an example with include the EditFindFound() Word function.

You can use all this from Access using the word object.



0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963478
Using Word  bookmarks you can go directly to bookmarks from Access word object. This may be more convenient depending on your application. However you can investigate these alternatives yourself with word macro recorder etc.
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963479
insert this in the code sample:

    wrd.insert "how easy is this? :)"
    wrd.startofdocument
    wrd.editfind "easy"
    If wrd.editfindfound() = 0 Then
        MsgBox "not found"
    End If

hows that!
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963480
I should have used a filesave or filesaveas function for the opened file otherwise Word will prompt you. in case you were wondering why Word is prompting.

the sample is only a rough guide, but you can see how easy it is compared with DDE. youll never look back. :)
0
 
LVL 1

Author Comment

by:BBC
ID: 1963481
Okay, it will take me some hours to fully get used to this "new" concept. But before I will go to sleep, because it got really late.
I wonder how the document gets viewed, initiated bye the code in access.
Do I have any "close" function ?

OK, I'll check all these things in a few hours. Think you have very good chances to get the points ...

l8ter !

0
 
LVL 1

Author Comment

by:BBC
ID: 1963482
Hey again!
I tried and tried but was not able to get it working like I'd like.
I open up Word via OLE and edit the document. Fine. But how do I get the document displayed ?
You can see Word 6 while the document is beeing edited via OLE. After that Word auomatically exits again.
With Word 97 you even don't see the document while it is beeing edited.
And sometimes I had problems with getting the started word-tasks out of the memory again.
Any further suggestions ?

BTW: If you'd like you can get the 150 pts with an B rating NOW and I will make a new question with the above or you can try to solve this entierly an you will get an A. Its your decision :-)

Ciao!
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963483
Hi

Unfortunatley the automation object cannot be mainpulated by the user while a client has control - the client application could not keep track of the unpredictable intreactivity between  its controlled object and user.

you would need to close automation object and  shell out to Word, after youve done your automation tasks.

i do not know your application to see why it needs to be visible except when the automation is finished.

if you could paste the  code here or email to me i could get a better understanding of what your  objectives are.






0
 
LVL 1

Author Comment

by:BBC
ID: 1963484
Ok, I have sent you my specifications with an email. I will now close this question and put up a new one, because I didn't hear from you for some days now.
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1963485
Sorry BBC, there were too many platforms in your email and im not set up for all of them. Its better as a separate issue.
0
 
LVL 1

Author Comment

by:BBC
ID: 1963486
I needed the  .appshow command :-)
This works for Word97 now. But how is this command called in Word 6, and what is the name in der GERMAN Word-Version ???
Is there any way to get viewed all the OLE commands a application has ?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question