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

Report
-
Posts
1260
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 3, 2020
-
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

Posts
3
Registration date
Thursday February 19, 2015
Status
Member
Last seen
February 20, 2015

solved!
Posts
1260
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 3, 2020
213
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).
Blocked Profile
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! :)
Posts
3
Registration date
Thursday February 19, 2015
Status
Member
Last seen
February 20, 2015

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.
Posts
3
Registration date
Thursday February 19, 2015
Status
Member
Last seen
February 20, 2015

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
Posts
1260
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 3, 2020
213
Hello Soaping_Gal/Janit,

Well done!

Glad I could help.

Cheerio,
vcoolio.