Jump to content
Sign in to follow this  

AppleScript VB change in Mac Office 2011

Recommended Posts

amallison    0

The following script works fine with MacOS 10.6 and Mac Word 2004.


My client has moved to MacOS 10.8 and Mac Word 2011 and the script is not working.

Can anyone suggest what is required to be changed?


I have tried changing 'do Visual Basic' to 'run VB macro macro name' but that wasn't the whole answer.



"tell application "FileMaker Pro"¶

tell database "ContactSystem"¶

tell table "ContactSystem"¶

set user_name to cell "ExportMyName"¶

set user_fullname to cell "ExportMyFullName"¶

set user_position to cell "ExportMyPosition"¶

set user_phone to cell "ExportMyPhone"¶

set user_fax to cell "ExportMyFax"¶

set user_email to cell "ExportMyEmail"¶

set policy_commission to cell "ExportPolicyCommission"¶

set system_reference to cell "ExportReference"¶

set client_code to cell "CurrentClient"¶

set contact_title to cell "ExportContactTitle"¶

set contact_first to cell "ExportContactFirst"¶

set contact_last to cell "ExportContactLast"¶

set contact_position to cell "ExportContactPosition"¶

set contact_address1 to cell "ExportContactAddress1"¶

set contact_suburb to cell "ExportContactSuburb"¶

set contact_state to cell "ExportContactState"¶

set contact_pcode to cell "ExportContactPCode"¶

set contact_phone to cell "ExportContactPhone"¶

set contact_fax to cell "ExportContactFax"¶

set contact_email to cell "ExportContactEmail"¶

set contact_company to cell "ExportContactCompany"¶

set create_date to the day of (the current date) & " " & the month of (the current date) & ", " & the year of (the current date) as string¶

set create_time to the time string of (the current date) as string¶

end tell¶

end tell¶

end tell¶

ReplaceWordText("<MyName>", user_name)¶

ReplaceWordText("<MyFullName>", user_fullname)¶

ReplaceWordText("<MyPosition>", user_position)¶

ReplaceWordText("<MyPhone>", user_phone)¶

ReplaceWordText("<MyFax>", user_fax)¶

ReplaceWordText("<MyEmail>", user_email)¶

ReplaceWordText("<SystemReference>", system_reference)¶

ReplaceWordText("<ClientCode>", client_code)¶

ReplaceWordText("<ContactTitle>", contact_title)¶

ReplaceWordText("<ContactFirst>", contact_first)¶

ReplaceWordText("<ContactLast>", contact_last)¶

ReplaceWordText("<ContactPosition>", contact_position)¶

ReplaceWordText("<ContactAddress1>", contact_address1)¶

ReplaceWordText("<ContactSuburb>", contact_suburb)¶

ReplaceWordText("<ContactState>", contact_state)¶

ReplaceWordText("<ContactPCode>", contact_pcode)¶

ReplaceWordText("<ContactPhone>", contact_phone)¶

ReplaceWordText("<ContactFax>", contact_fax)¶

ReplaceWordText("<ContactEmail>", contact_email)¶

ReplaceWordText("<ContactCompany>", contact_company)¶

ReplaceWordText("<CreateDate>", create_date)¶

ReplaceWordText("<CreateTime>", create_time)¶

ReplaceWordText("<PolicyInvoiceCommission>", policy_commission)¶

on ReplaceWordText(FindText, ReplaceText)¶

  tell application "Microsoft Word"¶

    do Visual Basic "  With Selection.Find¶

    .Text = "" & FindText & ""¶

    .Replacement.Text = "" & ReplaceText & ""¶

    .Forward = True¶

    .Wrap = wdFindContinue¶

  End With "¶

     do Visual Basic " Selection.Find.Execute Replace:=wdReplaceAll"¶

  end tell¶

end ReplaceWordText"

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.