Group:  Microsoft Word ยป microsoft.public.word.drawing.graphics
Thread: Word Macro to insert and position picture to correct place in docu

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Word Macro to insert and position picture to correct place in docu
D.Harper 28.07.2006 15:53:02
I can get a picture inserted into my document with a macro. But, I need to
move where this picture places itself in my document. It automatically posts
centered, and I need it on the right side of my document. I can't do this
with auto text, I have to do it with a macro button on my toolbar.

Can anyone help with the code for resizing and moving a picture once it is
inserted in a document?
Re: Word Macro to insert and position picture to correct place in docu
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 29.07.2006 14:04:25
Hi =?Utf-8?B?RC5IYXJwZXI=?=,

[Quoted Text]
> I can get a picture inserted into my document with a macro. But, I need to
> move where this picture places itself in my document. It automatically posts
> centered, and I need it on the right side of my document. I can't do this
> with auto text, I have to do it with a macro button on my toolbar.
>
> Can anyone help with the code for resizing and moving a picture once it is
> inserted in a document?
>
Show us the macro you've got so far, so that we can build on it?

Also, which version of Word do you have?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Re: Word Macro to insert and position picture to correct place in
D.Harper 01.08.2006 14:17:02
Here is what I have that actually works:



Sub Macro3()
'
' Macro3 Macro
' Macro recorded 7/20/2006 by Delana Harper
'


With ActiveDocument.Bookmarks(1)

Selection.InlineShapes.AddPicture
FileName:="P:\dharper\GovOfficeTemplates\msoffice\signature\jer.jpg",
LinkToFile:= _
False, SaveWithDocument:=True

End With

End Sub


"Cindy M -WordMVP-" wrote:

[Quoted Text]
> Hi =?Utf-8?B?RC5IYXJwZXI=?=,
>
> > I can get a picture inserted into my document with a macro. But, I need to
> > move where this picture places itself in my document. It automatically posts
> > centered, and I need it on the right side of my document. I can't do this
> > with auto text, I have to do it with a macro button on my toolbar.
> >
> > Can anyone help with the code for resizing and moving a picture once it is
> > inserted in a document?
> >
> Show us the macro you've got so far, so that we can build on it?
>
> Also, which version of Word do you have?
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
>
>
Re: Word Macro to insert and position picture to correct place in
D.Harper 01.08.2006 14:17:03
I have 2 versions of word. I have XP on my main computer and 2003 on my
secondary computer.

"Cindy M -WordMVP-" wrote:

[Quoted Text]
> Hi =?Utf-8?B?RC5IYXJwZXI=?=,
>
> > I can get a picture inserted into my document with a macro. But, I need to
> > move where this picture places itself in my document. It automatically posts
> > centered, and I need it on the right side of my document. I can't do this
> > with auto text, I have to do it with a macro button on my toolbar.
> >
> > Can anyone help with the code for resizing and moving a picture once it is
> > inserted in a document?
> >
> Show us the macro you've got so far, so that we can build on it?
>
> Also, which version of Word do you have?
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
>
>
Re: Word Macro to insert and position picture to correct place in
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 02.08.2006 19:33:50
Hi Delana,

[Quoted Text]
> Here is what I have that actually works:
>
OK, I'm going to interpret everything very literally: you're inserting a picture
inline with the text - this would mean text won't "flow" around the picture. One
line of text would align with the bottom of the picture, otherwise the text would
be above and below. (Or the picture could be in a line all by itself, with text
above and below). Is this what you want? If yes, if you click the "Right align"
paragraph button, the picture would move to the right.

If this isn't right, can you explain what commands you use on the result of
"Macro3" to make it look right?

> Sub Macro3()
> '
> ' Macro3 Macro
> ' Macro recorded 7/20/2006 by Delana Harper
> '
>
>
> With ActiveDocument.Bookmarks(1)
>
> Selection.InlineShapes.AddPicture
> FileName:="P:\dharper\GovOfficeTemplates\msoffice\signature\jer.jpg",
> LinkToFile:= _
> False, SaveWithDocument:=True
>
> End With
>
> End Sub
>
>
> "Cindy M -WordMVP-" wrote:
>
> > Hi =?Utf-8?B?RC5IYXJwZXI=?=,
> >
> > > I can get a picture inserted into my document with a macro. But, I need to
> > > move where this picture places itself in my document. It automatically posts
> > > centered, and I need it on the right side of my document. I can't do this
> > > with auto text, I have to do it with a macro button on my toolbar.
> > >
> > > Can anyone help with the code for resizing and moving a picture once it is
> > > inserted in a document?
> > >
> > Show us the macro you've got so far, so that we can build on it?
> >
> > Also, which version of Word do you have?
>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :-)

Re: Word Macro to insert and position picture to correct place in
D.Harper 02.08.2006 21:44:42
Cindy,

I am inserting the picture between 2 lines at a bookmark. The document is a
letter, and the picture I want to insert is a signature. I have figured out
how to get the picture to insert at the bookmark. I have a couple of problems
though. If I insert the picture without referencing the bookmark, then it is
centered on the page. That is the code I already provided. If I insert the
picture at the bookmark, it will insert the bookmark and picture wherever my
cursor is currently placed in the document instead of where I have the
bookmark inserted. I can try the steps you mention below to move the picture
to the right, but I am wondering why the bookmark is moving instead of having
the picture insert at the correct place. Also, I need to change the picture
so that the signature (the content of the picture) is not hiding the rest of
the letter salutation.
Any suggestions on that?

Thanks for any help you can provide.

Delana

"Cindy M -WordMVP-" wrote:

[Quoted Text]
> Hi Delana,
>
> > Here is what I have that actually works:
> >
> OK, I'm going to interpret everything very literally: you're inserting a picture
> inline with the text - this would mean text won't "flow" around the picture. One
> line of text would align with the bottom of the picture, otherwise the text would
> be above and below. (Or the picture could be in a line all by itself, with text
> above and below). Is this what you want? If yes, if you click the "Right align"
> paragraph button, the picture would move to the right.
>
> If this isn't right, can you explain what commands you use on the result of
> "Macro3" to make it look right?
>
> > Sub Macro3()
> > '
> > ' Macro3 Macro
> > ' Macro recorded 7/20/2006 by Delana Harper
> > '
> >
> >
> > With ActiveDocument.Bookmarks(1)
> >
> > Selection.InlineShapes.AddPicture
> > FileName:="P:\dharper\GovOfficeTemplates\msoffice\signature\jer.jpg",
> > LinkToFile:= _
> > False, SaveWithDocument:=True
> >
> > End With
> >
> > End Sub
> >
> >
> > "Cindy M -WordMVP-" wrote:
> >
> > > Hi =?Utf-8?B?RC5IYXJwZXI=?=,
> > >
> > > > I can get a picture inserted into my document with a macro. But, I need to
> > > > move where this picture places itself in my document. It automatically posts
> > > > centered, and I need it on the right side of my document. I can't do this
> > > > with auto text, I have to do it with a macro button on my toolbar.
> > > >
> > > > Can anyone help with the code for resizing and moving a picture once it is
> > > > inserted in a document?
> > > >
> > > Show us the macro you've got so far, so that we can build on it?
> > >
> > > Also, which version of Word do you have?
> >
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or reply in
> the newsgroup and not by e-mail :-)
>
>
Re: Word Macro to insert and position picture to correct place in
Cindy M -WordMVP- <C.Meister-C[ at ]hispeed.ch> 03.08.2006 13:57:26
Hi Delana,

[Quoted Text]
> I am inserting the picture between 2 lines at a bookmark. The document is a
> letter, and the picture I want to insert is a signature. I have figured out
> how to get the picture to insert at the bookmark. I have a couple of problems
> though. If I insert the picture without referencing the bookmark, then it is
> centered on the page. That is the code I already provided. If I insert the
> picture at the bookmark, it will insert the bookmark and picture wherever my
> cursor is currently placed in the document instead of where I have the
> bookmark inserted. I can try the steps you mention below to move the picture
> to the right, but I am wondering why the bookmark is moving instead of having
> the picture insert at the correct place. Also, I need to change the picture
> so that the signature (the content of the picture) is not hiding the rest of
> the letter salutation.
>
OK, click in the empty paragraph where you have the bookmark. Right-align it (no
need to use macro code to do something you can pre-set in the document). Now all
that remains is to insert the file at the bookmark. Try this:

Sub InsertSigAtBookmark
Dim doc as Word.Document
Dim bkmName as String
Dim SigFile as String

Set doc = ActiveDocument
bkmName = "BookmarkName"
SigFile = "P:\dharper\GovOfficeTemplates\msoffice\signature\jer.jpg"
doc.InlineShapes.AddPicture :
FileName:=SigFile, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=doc.Bookmarks(bkmName).Range
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net