Add picture in a the middle of textbox

K

Ken

Hi,

I have one more question is how can I insert a picture in
the center of the textbox.

Thanks!

Ken
 
S

Steve Hudson

G'day "Ken" <[email protected]>,

take the left edge of thetextbox, add it to the right edge, divide by
two to get the centre x for the pic insert

ditto for y from top & bottom

insert picture at that x and y

get its height and width, divide each by two and subtract from the x,y
to reposition the picture.


Ken said:
Hi,

I have one more question is how can I insert a picture in
the center of the textbox.

Thanks!

Ken

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
R

Richard Rönnbäck

I am trying to do what I thought shouldn't be that hard but I am now totally
lost.

I am trying to get the document title from a Microsoft Word X document (the
title you fill in via File>Properties>Summary>Title)

Since it not exposed to AppleScript I thought I could stitch it together
with VBA, but despite reading Microsoft step by step article

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:
80/support/kb/ARTICLES/Q184/4/40.asp&NoWebContent=1

over and over again I still don't get it.

Since I want a value back I assume it must be a function, which is (and it
does seem to work as expected):

Function GetTitle(strWordTitle As String) As String
Dim dp As Object
Set dp = ActiveDocument.BuiltInDocumentProperties
strWordTitle = dp(wdPropertyTitle)
End Function


I have then, with endless variations, tried to call from, and get the value
back to, the AppleScript, but to no avail. It should be something like:

tell application "Microsoft Word"
tell document 1
do script "GetTitle()"
set myTitle to the result
end tell
end tell


Can anyone help me?


TIA

/ Richard
 
J

Joe Weaks

Richard,
Have you tried putting the document title into the clipboard and then
having access to it in your AS?
Joe Weaks
 
R

Richard Rönnbäck

Joe,

Thanks for the suggestion. It would probably work, but the clipboard is a
volatile thing, so I was kind of hoping I wouldn't have to use that route.
Also, I will be needing some other properties, so it would be nice if I
could get them in one go, and assign them to variables.

But I will probably do as you say

Thanks
 
J

Joe Weaks

Richard,
I couldn't agree more. Using clipboard as a means of getting variables
between VBA and Applescript is quirky at best. Here are a couple more
options:
1.
The method I use is to have a script library that you pass variables to
using the "run script" method in VBA. Something like this:

MacScript ("run script ""pathTo:myScript"" with parameters {" &
documentTitle & "," & myProperty & ",False}")

The applescript you're running must have this run handler to receive
the variables:

on run(documentTitle, theProperty, theBoolean)
-- do stuff
end

2.
The method recommended on the mvps.org site is to call VB Method Print
#FileNumber and write the output to a temporary text file which the
applescript can then read and parse. That method works well, too.

Depends on what you're wanting to do.
Cheers,
Joe Weaks
 
H

Heyman

tell application "Microsoft Word"
activate
return the name of the front document
end tell

:
 
R

Richard Rönnbäck

Thank you for trying to help, but perhaps I didn't make myself clear: It is
not the file name I want, but the title as set by the user, they are two
completely different things. The former is, as your example shows, available
to AppleScript, but the latter is not.

It is like asking for someone's social security number and getting their
middle name in return. They are both useful properties of the same person,
but they are not interchangeable.
 
W

Word Heretic

G'day Richard Rönnbäck <[email protected]>,

once you have the word app object, it's

application.ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)

HTH me no know Mac,

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


Richard Rönnbäck was spinning this yarn:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top