PDA

View Full Version : Shapes.AddPicture - Has it changed?



Trigon
05-30-2014, 07:07 AM
Hi All

I've spent some time looking for this on Google with no joy :-(

I have created a marco that automatically turns any document into our company letterhead by inserting our logo and address etc.

Everything works fine when using it on our old .doc documents but as soon as its used in a .docx things are not inserted in the right places. Heres a snippet of the offending code:

ActiveDocument.Shapes.AddPicture(FileName:= _
"N:\Bromsgrove\Standards\General\Trigon Logo.BMP" _
, LinkToFile:=False, SaveWithDocument:=True, Left:=413, Top:=23, Width:=140, Height:=116.4).WrapFormat.Type = _
wdWrapTight

As far as I was aware with no anchor the left and the top would go from the edge of the page, is this different with .docx?

Thanks for any help

Chris

Bob Phillips
05-30-2014, 08:08 AM
Why wouldn't you just use a document template with all of the images text already set up?

Trigon
05-30-2014, 08:22 AM
Why wouldn't you just use a document template with all of the images text already set up?

Because that would mean going and amending all of our standards (about 400+)

Thanks

Bob Phillips
05-30-2014, 08:36 AM
Ever thought you might have too many standards? It's always a good practice when you get a situation like this where you are doing the wrong thing to look at whether Chines practices are dictating things.

macropod
05-30-2014, 03:07 PM
The AddPicture method does indeed behave differently with docx files. My preferred approach for inserting pictures at a specified location is to first insert it inline in the paragraph to which it is to be anchored, then use the ConvertToShape method to change the wrap format and, finally, relocate the shape, if necessary after that.

Paul_Hossler
05-30-2014, 06:05 PM
Because that would mean going and amending all of our standards (about 400+)

Thanks


Maybe make a CompanyStandard.dotx template and then just do a macro to loop the 400+ standards and attach the new CompanyStandard.dotx to each one?

macropod
05-30-2014, 06:15 PM
Maybe make a CompanyStandard.dotx template and then just do a macro to loop the 400+ standards and attach the new CompanyStandard.dotx to each one?
Attaching a new template won't change the existing headers.

Paul_Hossler
05-31-2014, 02:01 PM
Paul -- +1

Paul -- -1


I should have had a little more coffee

fumei
05-31-2014, 03:48 PM
I am trying to get my head around 400+ standards. Are these 400+ templates??? Clearly not as you:

"turns any document into our company letterhead "

Seems wonky to me. And it sure does not sound at all like adhering to any standard.

Trigon
06-03-2014, 09:13 AM
We're a pensions admin company.

We have loads of different clients and loads of different procedures. Due to the complexity of the pensions industry in most cases each client will require their own wording depending on how their pension scheme has been set up.

This is whats caused us to have so many different standards which have been created over the years.


So what is the add picture method doing differently then?

Cheers

Chris

macropod
06-03-2014, 05:12 PM
So what is the add picture method doing differently then?
Not behaving the way you want it to. Evidently, the way the positioning is done has changed.