Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
application.displayalerts=false
for each wb in workbooks
for each ws in wb.worksheets
ws.shapes(1).delete
'put your code here substituting ws for activesheet
next
wb.save
wb.close
next
application.displayalerts=true
application.displayalerts=false
for each dc in documents
dc.shapes(1).delete
'put your code here substituting dc for activedocument
dc.save
dc.close
next
application.displayalerts=true
Sub ChangePic()
Dim oFile
oFile = Dir("c:\temp\*.doc")
Do While oFile <> ""
Application.Documents.Open FileName:="c:\temp\" & oFile
With Selection
.GoTo what:=wdGoToGraphic, Count:=1
.Delete
.InlineShapes.AddPicture FileName:="C:\temp\2.jpg"
End With
If ActiveDocument.Saved = False Then ActiveDocument.Save
ActiveDocument.Close
oFile = Dir
Loop
End Sub
Could you explain this please? Why would you want it to do this every time? Are to trying to actually change the image, or not?So far, I've tried using a macro that runs when the file is opened, but thats no good because I cant have it searching for an image everytime the doc. is opened..
This does not makes sense actually.Does anyone have any information on how to change an image in numerous Word and Excel documents w/a batch process instead of individually changing the image in every document?
Dim oFile
oFile = Dir("c:\temp\*.doc")
Do While oFile <> ""
Dim WordApp As New Microsoft.Office.Interop.Word.ApplicationClass
WordApp.Documents.Open(FileName:="c:\temp\" & oFile)
With WordApp.Selection
.GoTo(what:=wdGoToGraphic, Count:=1)
.Delete()
.InlineShapes.AddPicture(FileName:="C:\temp\2.jpg")
End With
If WordApp.ActiveDocument.Saved = False Then WordApp.ActiveDocument.Save()
WordApp.ActiveDocument.Close()
oFile = Dir()
Loop
Do While [i]blah blah[/i]
Dim WordApp As New Microsoft.Office.Interop.Word.ApplicationClass
' other stuff...blah blah
Loop