Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-23-2015, 04:35 AM
gmaxey gmaxey is offline ord vba replace the variable text with variable images to make offer products with images Windows 7 32bit ord vba replace the variable text with variable images to make offer products with images Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

The code you have posted won't even compile so it won't do anything. What does
September CurrrentRange supposed to mean?

Even after you got you declarations straightened out the fundamental error in your ways is using the selection object. You use the selection object to find something, find it and then redefine the selection. It is therefore impossible to find anything else in your very limited selection.

Learn to use the range object which leaves the selection alone:

Code:
Sub Replace_String_ImageNUOVO()
'A basic Word macro coded by Greg Maxey
Dim PixPathandName As String
Dim oRng As Range
  PixPathandName = "J:\APPS\ACCESS\MDB2007\FOTOxOFFERTE\"
  Set oRng = Selection.Range
  With oRng.Find
    .Text = "FOTO_"
    Do While .Execute()
      oRng.MoveEnd wdWord, 1
      Selection.InlineShapes.AddPicture FileName:=PixPathandName & Trim(oRng.Text) & ".JPG", _
      LinkToFile:=False, SaveWithDocument:=True
      oRng.Collapse wdCollapseEnd
     Loop
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
images, text



Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Variable or With block variable not set Raza Excel Programming 8 01-15-2015 12:19 AM
Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge Berryblue Mail Merge 1 11-13-2014 05:36 PM
ord vba replace the variable text with variable images to make offer products with images Run-time error 91 object variable or with block variable not set JUST ME Word VBA 4 03-25-2014 06:56 AM
ord vba replace the variable text with variable images to make offer products with images object variable or with block variable not set MJP143 Excel 1 02-11-2013 05:07 AM
ord vba replace the variable text with variable images to make offer products with images Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft