Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 8 Apr 2008 10:05:02 -0700 (PDT),    group: microsoft.public.word.vba.beginners        back       


remove image from file with vba   
hello, any know how I can remove a picture from file (.doc) with vba
code??
( i dont know the name of picture to remove)

thx in adv.
date: Tue, 8 Apr 2008 10:05:02 -0700 (PDT)   author:   unknown

Re: remove image from file with vba   
wrote in message 
news:585e5960-388a-4176-8de6-f81364edc59e@8g2000hsu.googlegroups.com...
> hello, any know how I can remove a picture from file (.doc) with vba
> code??
> ( i dont know the name of picture to remove)
>
> thx in adv.
>

You need some means of identifying the picture. Is it "floating" or 
"inline"? The method required is different in the two cases. Is the picture 
the only one in the document? If not, what method is available to work out 
which is the right one? Is it the only one on the first page for instance?

Once you have a completely unmistakable way of identifying the right 
picture, it is not hard to delete it. But we need to work first on 
identifying it.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Tue, 8 Apr 2008 18:30:44 +0100   author:   Jonathan West

Re: remove image from file with vba   
On 8 abr, 13:30, "Jonathan West"  wrote:
>  wrote in message
>
> news:585e5960-388a-4176-8de6-f81364edc59e@8g2000hsu.googlegroups.com...
>
> > hello, any know how I can remove a picture from file (.doc) with vba
> > code??
> > ( i dont know the name of picture to remove)
>
> > thx in adv.
>
> You need some means of identifying the picture. Is it "floating" or
> "inline"? The method required is different in the two cases. Is the picture
> the only one in the document? If not, what method is available to work out
> which is the right one? Is it the only one on the first page for instance?
>
> Once you have a completely unmistakable way of identifying the right
> picture, it is not hard to delete it. But we need to work first on
> identifying it.
>
> --
> Regards
> Jonathan West - Word MVPwww.intelligentdocuments.co.uk
> Please reply to the newsgroup



thx.

-My picture is inline
-Is the only one Picture in my document.
- Only in the first page.

thx again
date: Tue, 8 Apr 2008 15:13:52 -0700 (PDT)   author:   unknown

Re: remove image from file with vba   
wrote in message 
news:e5580d3c-e628-4e61-98a1-a9d29d015f5e@a70g2000hsh.googlegroups.com...
> On 8 abr, 13:30, "Jonathan West"  wrote:
>>  wrote in message
>>
>> news:585e5960-388a-4176-8de6-f81364edc59e@8g2000hsu.googlegroups.com...
>>
>> > hello, any know how I can remove a picture from file (.doc) with vba
>> > code??
>> > ( i dont know the name of picture to remove)
>>
>> > thx in adv.
>>
>> You need some means of identifying the picture. Is it "floating" or
>> "inline"? The method required is different in the two cases. Is the 
>> picture
>> the only one in the document? If not, what method is available to work 
>> out
>> which is the right one? Is it the only one on the first page for 
>> instance?
>>
>> Once you have a completely unmistakable way of identifying the right
>> picture, it is not hard to delete it. But we need to work first on
>> identifying it.
>>
>> --
>> Regards
>> Jonathan West - Word MVPwww.intelligentdocuments.co.uk
>> Please reply to the newsgroup
>
>
>
> thx.
>
> -My picture is inline
> -Is the only one Picture in my document.
> - Only in the first page.
>


In that case, one line of code will remove the picture, as follows

ActiveDocument.Range.InlineShapes(1).Delete


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Tue, 8 Apr 2008 23:23:31 +0100   author:   Jonathan West

Re: remove image from file with vba   
ok, thx this works!!!

and last questions, with vba i cant know the name of my inline
picture, (by example my_pict.jpg?)
On 8 abr, 18:23, "Jonathan West"  wrote:
>  wrote in message
>
> news:e5580d3c-e628-4e61-98a1-a9d29d015f5e@a70g2000hsh.googlegroups.com...
>
>
>
> > On 8 abr, 13:30, "Jonathan West"  wrote:
> >>  wrote in message
>
> >>news:585e5960-388a-4176-8de6-f81364edc59e@8g2000hsu.googlegroups.com...
>
> >> > hello, any know how I can remove a picture from file (.doc) with vba
> >> > code??
> >> > ( i dont know the name of picture to remove)
>
> >> > thx in adv.
>
> >> You need some means of identifying the picture. Is it "floating" or
> >> "inline"? The method required is different in the two cases. Is the
> >> picture
> >> the only one in the document? If not, what method is available to work
> >> out
> >> which is the right one? Is it the only one on the first page for
> >> instance?
>
> >> Once you have a completely unmistakable way of identifying the right
> >> picture, it is not hard to delete it. But we need to work first on
> >> identifying it.
>
> >> --
> >> Regards
> >> Jonathan West - Word MVPwww.intelligentdocuments.co.uk
> >> Please reply to the newsgroup
>
> > thx.
>
> > -My picture is inline
> > -Is the only one Picture in my document.
> > - Only in the first page.
>
> In that case, one line of code will remove the picture, as follows
>
> ActiveDocument.Range.InlineShapes(1).Delete
>
> --
> Regards
> Jonathan West - Word MVPwww.intelligentdocuments.co.uk
> Please reply to the newsgroup
date: Tue, 8 Apr 2008 15:28:57 -0700 (PDT)   author:   unknown

Re: remove image from file with vba   
>and last questions, with vba i cant know the name of my inline
>picture, (by example my_pict.jpg?)


Nope.  It is an InlineShape, it has no name like my_pict.jpg

-- 
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200804/1
date: Wed, 09 Apr 2008 19:37:05 GMT   author:   fumei via OfficeKB.com u37563@uwe

Re: remove image from file with vba   
wrote in message 
news:65b387c0-7116-4020-bf75-1fdfcc21bcc1@e67g2000hsa.googlegroups.com...
> ok, thx this works!!!
>
> and last questions, with vba i cant know the name of my inline
> picture, (by example my_pict.jpg?)

Once a picture has been inserted, unless you have inserted it as a link, no 
record is kept of the name of the file from which it came. The file might 
not have had a name if for instance the picture was pasted from the 
clipboard.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Thu, 10 Apr 2008 10:20:03 +0100   author:   Jonathan West

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us