How to remove image with VB?

Solved/Closed
Janit - Feb 19, 2015 at 06:56 PM
vcoolio Posts 1362 Registration date Thursday July 24, 2014 Status Moderator Last seen September 29, 2022 - 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.

4 replies

Soaping_Gal Posts 3 Registration date Thursday February 19, 2015 Status Member Last seen February 20, 2015
Feb 19, 2015 at 09:40 PM
solved!
0
vcoolio Posts 1362 Registration date Thursday July 24, 2014 Status Moderator Last seen September 29, 2022 250
Feb 19, 2015 at 11:41 PM
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).
0
Blocked Profile
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! :)
0
Soaping_Gal Posts 3 Registration date Thursday February 19, 2015 Status Member Last seen February 20, 2015
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.
0
Soaping_Gal Posts 3 Registration date Thursday February 19, 2015 Status Member Last seen February 20, 2015
Feb 20, 2015 at 08:33 AM
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
0
vcoolio Posts 1362 Registration date Thursday July 24, 2014 Status Moderator Last seen September 29, 2022 250
Feb 20, 2015 at 12:42 PM
Hello Soaping_Gal/Janit,

Well done!

Glad I could help.

Cheerio,
vcoolio.
0