How to remove image with VB? [Solved/Closed]

Janit - Feb 19, 2015 at 06:56 PM - Latest reply: vcoolio 1173 Posts Thursday July 24, 2014Registration dateModeratorStatus July 15, 2018 Last seen
- Feb 20, 2015 at 12:42 PM
Hello,

I have everything working but removing the image before saving. The code is not working and not even sure where to place it. (using excel 2003) below is what my VBA looks like:

Sub NextTicket()

Range("S1").Value = Range("S1").Value + 1
Range("C7:G9").ClearContents
Range("J8:M8").ClearContents

End Sub

Sub SaveTicketWithNewName()
Dim NewFN As Variant
' Copy Ticket to new workbook
ActiveSheet.Copy
NewFN = "C:\Users\Janit\Desktop\" & Range("S1").Value & ".xls"
ActiveWorkbook.SaveAs NewFN
ActiveWorkbook.Close
NextTicket

End Sub

Sub DeleteButton()
For Each sh In ActiveSheet.Shapes:
If sh.TopLeftCell.Address = "$U$10" Then sh.Delete
Next sh
End Sub

I do know the name of the object should there be another code to use instead?

Any help would be greatly appreciated.

See more 

6 replies

Soaping_Gal 3 Posts Thursday February 19, 2015Registration date February 20, 2015 Last seen - Feb 19, 2015 at 09:40 PM
0
Thank you
solved!
vcoolio 1173 Posts Thursday July 24, 2014Registration dateModeratorStatus July 15, 2018 Last seen - Feb 19, 2015 at 11:41 PM
0
Thank you
Hello Janit,

This looks familiar!

Solved by Soaping_Gal (same IP)? Could you please post your resolution so that all can see. That's what these type of forums are all about. Help one, help all.

If you are still having issues with the above code, please post back as we will still be able to help.

Kind regards.
vcoolio
(Moderator).
ac3mark 9993 Posts Monday June 3, 2013Registration dateModeratorStatus July 20, 2018 Last seen - Feb 20, 2015 at 09:38 AM
Wow, just happen to be on the same node on the ISP. Incredible, it is like they share the same cubicle at work or something! :)
Soaping_Gal 3 Posts Thursday February 19, 2015Registration date February 20, 2015 Last seen - Feb 20, 2015 at 11:11 AM
no, same person...ME :D solved! my other topic and started a new one as I was trying to resolve a new issue. So while waiting for a reply i simply researched, researched and researched along with quite a bit of trial and error.
Soaping_Gal 3 Posts Thursday February 19, 2015Registration date February 20, 2015 Last seen - Feb 20, 2015 at 08:33 AM
0
Thank you
This macro works with Excel 2003, will save, remove macro object, close saved project and increment invoice number. Thank you so much for all the help you provided when I was stuck making my first macro :D


Sub NextTicket()

Range("S1").Value = Range("S1").Value + 1
Range("C7:G9").ClearContents
Range("J8:M8").ClearContents
Range("J9:M9").ClearContents


End Sub


Sub SaveTicketWithNewName()
Dim NewFN As Variant
' Copy Ticket to new workbook
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy
ActiveSheet.Shapes.Range(Array("savemacro")).Delete
NewFN = "C:\Users\Janit\Desktop\" & Range("S1").Value & ".xls"
ActiveWorkbook.SaveAs NewFN
ActiveWorkbook.Close
NextTicket


End Sub
vcoolio 1173 Posts Thursday July 24, 2014Registration dateModeratorStatus July 15, 2018 Last seen - Feb 20, 2015 at 12:42 PM
0
Thank you
Hello Soaping_Gal/Janit,

Well done!

Glad I could help.

Cheerio,
vcoolio.