Microsoft Word API for Mac OS: Troubleshooting the Find/Replace function

In my previous topic at
http://discussions.apple.com/thread.jspa?threadID=2623068&tstart=0
we found out the way to connect to the Ms-Word from Objective-C through ScriptingBridge.
The connection works and the given text can be found and replaced using the method executeFindFindText: Although it generates exception and I am forced to put it in @try block and then continue with everything else in @catch.
There is another, more important problem: the WordFind class does not seem to "give feedback" i.e. I could not find the way to programatically find out whether my find/replace was successfull, nor could I set WordFind object properties prior to running.
The Class WordFind has many properties e.g.
@property (copy) NSString *content; // Returns or sets the text in the find object.
@property (readonly) BOOL found; // True if the search produces a match.
@property BOOL matchWholeWord; // Returns or sets if the find operation locates only entire words and not text that's part of a larger word.
I tried to set the property "matchWholeWord" or read the properties "found" and "content" but in vain.
As I understand, the property "found" should be the key component in my process because it should
return the BOOL value I need.
What am I doing incorrectly? Any suggestions?
Here is the final code:
#import <Cocoa/Cocoa.h>
#import "Word.h"
int main(int argc, char * argv[])
if(NSApplicationLoad())
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
wordApp=[SBApplication applicationWithBundleIdentifier:@"com.microsoft.Word"];
if([wordApp isRunning])
WordDocument *activeWordDoc=[wordApp activeDocument];
WordTextRange *allTextRange=[activeWordDoc textObject];
WordFind *findObj=[allTextRange findObject];
NSString findText=@"FirstText";
NSString *replaceText=@"SecondText";
[findObj setMatchWholeWord:YES];
NSLog(@"WholeWord: %i", [findObj matchWholeWord]);
@try
[findObj executeFindFindText:findText
matchCase:NO
matchWholeWord:NO
matchWildcards:YES
matchSoundsLike:NO
matchAllWordForms:NO
matchForward:YES
wrapFind:WordE265FindContinue
findFormat:NO
replaceWith:replaceText
replace:WordE273ReplaceAll];
@catch(NSException * e){
NSLog(@"Search Found:%i",[findObj found]);
NSLog(@"Search Content:%@",[findObj content]);
[pool drain];
return 0;

DavidMan wrote:
So, what is your suggestion?
Do it in pure AppleScript.
Whom to complain? Microsoft or Apple?
I'm not sure. All this stuff was new with Office 2008. It might work better with Office 2011. I would definitely ask on the Mac Office forum to see if anyone there knows any more: http://www.officeformac.com/productforums/

Similar Messages

  • I can't see the scrollbar on my microsoft word 2008 for mac documents

    For some reason, in microsoft word 2008 for mac, I can't see my scrollbars on my documents.  I've tried everything, but they aren't visible.  This problem started when I got my new mac air and transferred over my programs and files.  Any ideas?

    make sure your documents setting on your iPhone is truned on for the iCloud. Go to settings, > iCloud > switch documents & data is on.

  • Cannot Interact with Microsoft Word 2008 for Mac after Opening

    After I open Microsoft Word 2008 for Mac, either by opening a .docx file or opening Word from the Applications folder, I am not able to interact with the application whatsoever.  Selecting its icon in the dock does not bring any of its windows to the front, nor does it show the Word menu at the top; instead, it still shows the menu of whatever application was previously selected.  But the windows do exist if I move other windows out of the way.  If I do get to a Word window, I cannot click on anything, select anything, resize it, close it, or scroll.
    Other info: If I click and hold the Word icon in the doc, the menu displays as if the application were functioning normally; it does not show a Force Quit option, as it would if Word were frozen.  I do not see any dialogue boxes or anything that would take the focus away from the other windows.
    Background: I was able to successfully use Word without any problems before today, using the same installation of the application, same computer, and same operating system. I also never had this problem before Mavericks, though, as I said before, I didn't always have this problem in Mavericks.
    How do I get Word to function normally again?  Thanks for any help you can provide!

    After letting Word run for quite a while, a popup window told me there was an issue with the database.  I opened the Microsoft Database Utility and rebuilt the database.  It seems to be working fine now.

  • Locking Styles using Microsoft Word 2008 for Mac

    Greetings-
    I'm not sure if this is a good place to post a software question, but I having difficulty locking styles on Microsoft Word 2008 for Mac. When I try locking a document's styles on a PC it allows you to lock only the styles but allow users to edit anything else in the document. When I try to open the same document on a Mac the entire document is write protected.
    I tried setting up the document protection using my Mac and it only gave me these three options: Protect for: Track Changes, Comments, Forms. I only want to protect the styles.
    I hope this makes sense. Does anyone have any suggestions?
    Thanks.
    Kevin

    tnganalyst wrote:
    Does anyone have any suggestions?
    One suggestion is to ask in the Word forums at Mactopia, MS's site:
    http://www.officeformac.com/ProductForums/Word/
    Someone here may have an answer, but this is a forum for Apple products. As such, you may have a better chance of getting an answer there.
    Good luck!

  • Does Microsoft Entourage 2008 for mac work with the new Mac OS X v 10.7 Lion

    Does Microsoft Entourage 2008 for mac work with the new Mac OS X v 10.7 Lion?
    I am just about to install Lion just need to check to see if if my work e-mail will work

    Sarah,
    Check this link:
    http://roaringapps.com/app:2533
    It contains some issues that people have encountered with Lion and Office 2008. It appears it can work, but you may have to go through some of the steps a few of the posters there have listed.
    That website also contains a pretty large list of applications and if they will work with Lion.
    Hope this helps! (I am not affiliated in any way with the site linked).

  • How do I print on both sides of the paper on microsoft word, excel for mac?

    My printer supports printing in both sides of the paper, and prints fine on both sides any pdf file.
    But there is no way to make it print on both sides when using Microsft Word or Excel
    How do I set it up?

    Try asking in the Microsoft Office forums. http://answers.microsoft.com/en-us/mac?auth=1

  • Microsoft Word 2008 for Mac - remove all hyperlinks in a table?

    Hello!
    I'm using word 2008 with a table which I have populated with some wikipedia text.
    Consequently some of the words are hyperlinked.
    Now since it is a massive table, I'd rather not delete all these hyperlinks by hand.
    Is there a method to select them and delete all the hyperlinked words [but retain the words themselves]
    for example if the word says 'horse' in blue underlined hyperlink text, i would like to have it that the word 'horse' remains, but is no longer links to wikipedia's entry on horse
    thank you kindly

    Shenzi,
    I think you may have better success posting to a MS Office for Mac forum. For example:
    http://www.microsoft.com/mac/help.mspx
    Regards,
    Roger

  • Microsoft Word 2008 for Mac

    I have looked at both Pages 2008 and MS Word for my Mac trying to find a MLA format. In my English class, they showed us how to do it on MS Word for Windows, however the steps are nothing like for Mac.
    Anyone here recently had to write a MLA format report and remember how you went about setting it up?
    Obviously I'm hoping it includes a template like it does on Windows, I'd hate to have to set the margins and spacing for each page.

    TexanMan05 wrote:
    Found out in another forum that is possible to use templates for Windows in the Mac Version.
    How to do it is here: http://word.mvps.org/mac/Using-Windows-Templates.html
    Thought I'd post it incase someone else has this issue.
    You seem to have a reading problem.
    What did fruhulda twice tell you?
    P.

  • Microsoft Word 2004 for Mac, delete document

    I've tried to follow the directions for deleting documents in Word, but it doesn't work. If I have the document open, and I click file/versions, there is nothing under existing to delete (which is how you do it according to their directions). I've tried file/open and dragging the selected document to the trash as well as selecting and hitting delete, but that doesn't work either.

    This isn't the best forum for questions about Word, however, I'll have a go at it.
    Hope I'm not stating the obvious here. "Versions" in Word gives a user the ability to save various renditions of the same document. This way, you can return to an earlier version if necessary. However, before you can delete any version, you need to save it within the Version panel box. Once listed there, you simply need to highlight it via a mouse click, then select "delete".
    If you are looking to delete a word document other than a "versions copy", then the best place would be via the Finder, wherever you save your Word Documents. There, you can single-click a document, then Apple Key/Delete to send it to the trash.

  • Can't Save Microsoft Word & Excel for MAC files

    Has anyone encounter the software bug that prevent you from saving Microsoft for Word .doc and Excel workbook files to a USB drive attached to the Airport Extreme. After numerous conversations with level 2 technical support and a visit to the Apple Store where we recreated the problem with different Apple components, they confirmed there is a bug in their Airport Extreme Disk utility software. If you run into this problem, here is the solution:
    Under the Apple icon, select Go, Connect to Server. Under the drive address, type smb://10.0.1.1 This solves the problem. Delete the Airport Disk utility software from the startup program list and add the network drive associated with the smb server address into the startup file to automatically attach to the network when you log in.

    This is a well known issue and has been discussed in several threads. Here are a few:
    MS Word can't save to Airport Disk
    MS Word doesn't want to save docs to Airport Extreme connected HD
    Problems saving excel doc on USB AirPort disk
    Saving to external HD on USB
    Airport Extreme and External Hard Drive with Word

  • Microsoft Word 2011 for Mac

    Since yesterday I have been having trouble saving a large word document with additional word documents embedded. After some time when I go to save the document I receive a message stating that it cannot be saved when in use by another program. I select 'OK' and I get the time circle (whatever, it is called. it is the colorful circle that just spends when the system is not responding).  The circle doesn't go away. Yesterday, I manually forced a shut down and when I logged back in to the computer 2 files appeared Word Work File L_######. One I was able to open and the other (the large document with embedded documents) I was not.
    I ended up recreating the document. The same thing has happened today. I am thinking because my Macbook needs the latest software update that might be causing the problem; however, I don't have the issue with any other Microsoft programs.
    Any ideas?
    Candace

    do you know how to at least stop the time out circle?
    I concur with the others about using the MS Office forums for this issue. However, with regard to the question above, there really isn't a way to stop the beach ball cursor. That cursor only appears when a particular app is not responding. Sometimes that happens when an app is performing a lengthy and intensive task and is temporarily too busy to respond, in which case the cursor will eventually go away on its own. Other times, this happens because the app has frozen, in which case the cursor will never go away on its own, and the app must be force quit (press command-option-esc, select the app that's not responding and force it to quit). Note that force quitting should not be done too quickly, as forcing an app to quit while it is in the middle of some intense task can cause any number of problems, including corruption of whatever data the app was working with at the time. Any time force quitting becomes necessary, there is a serious problem with the app experiencing the issue.

  • Need help with Microsoft Word 2008 for Mac

    When I paste a picture in a word document and save it, it seems to show up without a problem. But when I go back in to edit or print the document, the picture is no longer there, only a box with a big red X in it (I've inserted a sample of what shows up). Does anyone know how to fix this problem? Thanks!

    Thanks for the suggestions, AussieDJ, but unfortunately I don't have a clue under what format to save a document other than as a word document. If anyone out there has encountered this problem with Word 08 and has some suggestions to resolve the issue, I'd sure appreciate hearing from you! Thanks!

  • Word 2011 for Mac: Advanced question regarding the navigation pane--aka sidebar

    Hi everyone--
    I'm a new Mac owner, with a Macbook Pro 13" 2.4 GHz Intel Core i5, with 8GB RAM, 256GB storage. I'm operating on the latest OS (Maverick), freshly purchased from the Apple store today (July 5, 2014).
    Can you help me figure out if there is some way, in Word 2011 for Mac, to use the navigation pane (aka Sidebar) to click and drag entire sections of the document to a new location? This was basic (advanced, but fundamental) functionality in every version of Word I've used in recent years on Windows machines, and it is the critical reason I purchased Word instead of using one of a dozen free options. My job involves managing and editing large documents--from 2500 to 90,000 words--and the navigation pane/sidebar is crucial to my sanity.
    Previously, I would open the navigation pane and it would show me the structure of my document based on the Heading types. I could click on a heading (say, a chapter title), inside the navigation pane, and drag it to a new location elsewhere in the document. So simple to rearrange the structure of large documents this way. Now, in the Word 2011 for Mac, I can call up the navigation pane (now called the "sidebar") and view the structure of the doc, but I can't actually click and drag anything in the navigation pane.
    Other than this, so far my switch to Mac has gone swimmingly. I love the machine, and am amazed at how much cleaner and easier it is to set up than Windows machines. I'm so frustrated that I even have to interface with Microsoft any more, but this one piece of functionality is critical to me. 
    Thank you in advance for any help you can provide.
    Heather

    Dear Heather,
    I don't know the specific answer to your question.
    But as a new Mac owner, you should make sure that you are using the very latest version of Word 2011 for Mac.
    My recommendation, if you haven't already done this, is to open Word and do Help > Check for Updates from Word's menu, and install any updates Microsoft has released.
    They typically issue updates once or twice a month.
    Enjoy your Mac!

  • Word 2008 for Mac and NFS mounted home directories "Save File" issues

    Greetings everyone,
    (Long time lurker, first time poster here)
    I admin a small network (under 20 workstaitons) with a centralized NFS server, with user home directories mounted via NFS upon login.  Users are authenticated via LDAP.  This is all working fine, there is no problem here.  The problem lies when my users use Microsoft Word 2008 for Mac.  When they attempt to save a file to thier Desktop (or Documents or any folder under thier home dir) they are met with the following message:
    (dialog box popup)
    "Word cannot save or create this file.  The disk maybe be full or write-protected.  Try one or more of the following: * Free more memory. * Make sure the disk you want to save the file on is not full, write-protected or damaged. (document-name.ext)"
    This happens regardless of file format (Doc, Docx, Txt) and regardless of saved location under the network mounted dir.  I've noticed that when saving Word creates a .tmp file in the target directory, which only further confuses me to the underlying cause of the issue.
    When users logon to a local machine account and attempt the save, there is no issue.
    I have found many posts in other commuity forums, including this one, indicating that the issue is a .TempoaryItems folder in the root of the mounted directory.  This folder already exists and is populated with entries such as "folder.2112" (where 2112 is the uid of the LDAP user).  I find other posts indicating that this is an issue with Word:2008 and OSX10.8, with finger pointing in either direction, but no real solution.
    I have installed all Office for Mac updates from Microsoft (latest version 12.3.6).
    I have verified permissions of the user's home dir.
    I have also ensured that this issue effects ONLY Microsoft Office 2008 for Mac apps, LibreOffice and other applications have no issue.
    Does *ANYONE* have a solution or workaround for this issue?  While we're trying to phase Microsoft products out, getting users to ditch Word and Excel is difficult without removing them from systems completely.  So any pointers or help would be greatly appreciated.
    Thanks.
    ~k

    I can't tell you how to fix bugs in an obsolete version of Office, but a possible workaround is to use mobile home directories under OS X Server. The home directories are hosted locally and synced with the server.

  • Word 2004 for Mac "Notebook"

    Hi,
    I'm a new Mac user. I've been using Microsoft Word 2004 for Mac's "Notebook" feature to take notes and record the audio for my class lectures. In the last week, my MacBook has locked-up three times when trying to stop the audio recording at the end of the lecture. Twice, I was able to recover the text, but not the audio. This morning, I was only able to recover part of the text. This morning, for the first time, it also locked up while recording and I lost both text and audio. It has typically locked-up as soon as I press "stop."
    Could I be doing something wrong?
    Thanks,
    Jake

    Since Word is not an Apple product, you'll probably want to use a forum dedicated to Microsoft's Mac products such as <http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups> rather than an Apple forum.
    Be sure to search the forum first in case someone has already had a similar question answered

Maybe you are looking for

  • Masters in new hard drive... and Aperture can't locate them!

    Hello guys, this is my first message here... I'm from Rome, I'm a photographer and I am - obvioulsy - a Mac enthusiast user! I use Aperture for a year, this is a great app for my workflow but now I have a "little big" problem. Today, I've bought a ne

  • Dual-routing messages in gateway/ext-domain

    Here's another question related to our impending rollout of Groupwise to our stores... Currently, our stores' POS systems receive text messages via the mainframe. To allow corporate users with Groupwise to send mail to the stores, we set up many year

  • Importing and Exporting in BAPI_GOODSMVT_CREATE

    Hi, I am using the BAPI_GOODSMVT_CREATE to have a goods issue, but I am doubtful why the GOODSMVT_HEADER and the GOODSMVT_CODE will be under exporting but GOODSMVT_HEADRET is under importing. Since when I test the BAPI in SE37, it is reverse, any rea

  • 2nd LOV in oracle forms

    I have an lov for dept_id, If the user is the not manager of that department, then I populate a message, you are not the supervisor and clear the dept_id field. If the user running the form is the manager, then after choosing the dept_id from the lov

  • How do I create a password to join a Wi-f

    I'm attempting to create a Wi-Fi connection for my iPad. The network asks for the password. I have never created a password. I am then instructed to contact the network admnistrator. How do I accomplish that?