

What's odd is this works well through the Word VBA debugger. Bigger than that, the window (at least on my machine) became globally modal.

But the behavior is odd - if you don't focus on the custom UI window before closing the dialog box, then the custom UI disappears. Unless you subsequently call something like "MsgBox 'something'" in VBA. When you invoke the sub via a button click, etc., the UI disappears or never presents.Set theReturn to theWindowLauncher's openUpdateOutput Property theWindowLauncher : class "MyWindowLauncher" Use framework "/Library/Frameworks/amework" 'If you want this to stick around, you have to do something like. 'I _cannot_ get it to work from the VBA when launched from a button in a document.Ĭommand = "osascript ~/Library/Application\ Scripts//OpenMyUI.scpt" Private Declare Function popen Lib "libc.dylib" (ByVal command As String, ByVal mode As String) As Long Which calls AppleScript (OpenMyUI.scpt) to call public method "show me the interface" in your framework.In this version, Word fields work fine - strings look great and all field fieldText properties can be accessed and set without issue. With this approach, you use vba to call osascript to call out to an applescript that hosts your UI (I know.

Option 2 - Framework w/ osascript + AppleScript I have absolutely no idea why this is failing and at this point I have to believe it's got to do with how the framework is interacting with Word when launched like this. But more times than not I just can't get at the fieldText. When it does work I get "corrupt" string responses. Microsoft Word got an error: Can’t get active document. Set theField to field theIndex of active document it just attempts to return the field text for a given field (by numeric index) on getFieldDataForFieldAtIndex:theIndex Thinking this could be odd behavior with the AppleScript-Objective-C bits when running via the external framework, I actually tried to call out to AppleScript from Objective-C (embed applescript, write wrapper in Obj-C, then load script at runtime). I can only say "corrupted" as the text appears to go from ascii text to some form of unicode characters and also appears to be truncated after that.ĮX: (Then : after "Name" is at position 256)

This worked well, but for a serious issue with Word field codes. Private Declare Sub MyLibOpenCustomUI Lib "/Library/Frameworks/amework/MyFramework" ()
