Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Remove A Picture In Excel, Using A Macro

I have created a macro in Excel that inserts a bunch of pictures onto a spreadsheet, now my problem is I want to do the complete opposite, and create a macro that removes the pictures I have just inserted. Here is how I am loading the pictures:


Thanks in advance..

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Can I Remove A Row In Excel With A Macro
Let say I want to do the following

IF cell = certain value, then remove the row


Excel Macro: Resize A Picture And Insert Into Spreadsheet
Hi, I'm new to excel macro programming and would like a macros that can iterate through a directory with large jpegs such as:


and create a thumbnail of each large image and save it to

c: humbs

The most important is the resized thumbnail MUST BE IN PROPORTION with the origianl image, so "keep aspect ratio".

Any help would be appreciated, thank you!!

Remove/add Macro
Four months ago, I added a macro, Insert Grid, that I wrote to (Word, office XP). Now, I cannot remember how I added it.
Also, I modified the macro and now I want to remove the old macro and add the new macro.

#1 I have a word doc called InsertGrid. When I open it I can go into VB (alt F11) and see, modify and save my macro.

#2 What are the steps to delete/remove the previous version of Insert Grid and get the new version of my macro Insert Grid in this word doc into


Remove Picture File From Picture Box
How I can remove the picture in picture box?

I use the code below to load the picture from file.. How I can clear the picture? or remove the picture file in the picture box?


Set Picture2 = LoadPicture(App.path & "output.bmp")
Printer.PaintPicture Picture2, 60, 13000, 2000, 800

Converting An Excel 2002 Macro To An Excel 95 Macro
Hi there, Iíve finally got my macro program to work (thanks everyone). Now I have to load the macro on a much older machine. I wrote the Macro on Excel 2002 and now Iím trying to run it on Excel for Windows 95 Version 7.0. Iíve loaded it up, but there are all sorts of errors. Does anyone know of a simple way to convert the macro code so it will run smoothly on Excel 7.0?

Macro To Remove Unwanted Lines
I am trying to write a macro to remove unwanted lines from a text document.

The document includes around 300 pages, and I want to remove all the lines except for around 100 of them. The lines that I want to keep begin:

"Tree length = "

Following this statement is an integer (which I also want to retain).

I have tried numerous permutations of macros which seem to delete all lines except for the 1 occurence.

Any help, please?

Charlie Butterworth

Macro To Remove Extension Off A File Name
I need to write a macro in excel that will take a file name like 320451r.lft located in a cell, drop the .lft and place the characters ahead of the decimal point into another cell. I've been looking through the help section to try and find a function that I can use but no luck so far. I'm pretty new to VB and I'm not aware of the majority of functions. Please help.



Macro Needs Modification To Remove Bugs.
Hi All, am new to VBA coding.
Following is the VBA code for excel that I am gonna use as a macro, however it generates error for the 6th line where I wanna paste the date in the new sheet. Can anyone look at this bug and suggest a solution.
My second problem is with the name of the new sheet that am creating in the line 5 and name it with the current date. However if I run this macro two to three times a day, then it generates error saying that a sheet with the current name already exists. So what I want to do is to check the names of the previous sheets, and if the current date name already exists then add "a", "b" or "c" as a distinguishing mark at the end of the name.
Also in line 6, instead of pasting on sheet1, I wanna paste my data in newly generated sheet as named above.

I hope the problem is not that trivial, but I just need a push up support.

Sub Update()
   Workbooks.Open "c:ckmoiedInv_Records.xls"
   Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
   ActiveSheet.Name = Day(Date) & Month(Date) & Year(Date)
   ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("G1:J4")
End Sub


Word Macro To Remove Page Breaks
Word Macro to remove page breaks ...?

Openning Excel And Running Macro From Word - Macro
Ok - I have a DB which I export to Excel, I then run a macro to "Groom The Data". I then run word and run a Macro (MailMerge to print labels) which retrieves data from the excel spreadsheet groomed above. Everything is working fine, despite my novice knowledge of VB, but I would like to do this in a single click.

I use a command line shortcut to Launch word and automatically have it run the macro, but I still have to Launch Excel and manually run its macro first.

I did not find a command line switch to make excel launch and run a macro. Is there any way I can Lauch Word have its Macro link to excel, then launch and run the excel macros before performing the macro I have set up in word (mailmerge)

In Other Words I have working macros in Word and Excel, I want the Word Macro to force the Excel macro to run before completing the rest of its duties.


Protecting Cells With Password + Automaticly Remove The Macro's
Hi, I have a spreadsheet with a macro. The macro contains some sub's. On the last sub i have recorded to protect some cells and some not. When i run this macro it automaticly get some values. I must do the same handling 60 TIMES and sen this speadsheet to 60 consumers. What i want is that i will NOT send the MACRO, how can i realise this?, I need this macro to get values and then i want to send it to the consumers, only the MACRO's i will not send. How can i make when the macro has that this delete hisself or something. Another problem is that i want a password protection, how can i do this in VB-script, when i record a macro to password protect it will not work, the password is not setting. I must do this 60 times you know how much time it needs to set the password 60 times with the hand, could we also protect the cells with a password in VB.

Could somebody describes what i can do?

Protecting Cells With Password + Automaticly Remove The Macro's
Hi, I have a spreadsheet with a macro. The macro contains some sub's. On the last sub i have recorded to protect some cells and some not. When i run this macro it automaticly get some values. I must do the same handling 60 TIMES and sen this speadsheet to 60 consumers. What i want is that i will NOT send the MACRO, how can i realise this?, I need this macro to get values and then i want to send it to the consumers, only the MACRO's i will not send. How can i make when the macro has that this delete hisself or something. Another problem is that i want a password protection, how can i do this in VB-script, when i record a macro to password protect it will not work, the password is not setting. I must do this 60 times you know how much time it needs to set the password 60 times with the hand, could we also protect the cells with a password in VB.

Could somebody describes what i can do?

Remove Picture
Srry if this seems a bit like a dumb question, but I just can't get it figured out! I'm sure the answer is right under my nose, but how do you remove a picture from a form at design time if you accidentally put one on? It's driving me nuts!

EDIT: Srry if i'm not clear, not a picture box/frame, a background picture

Remove Picture From The Top Of An App
Just a newbe here,
When you create a new project in VB6 and even when you create your exe the application by default will have a small picture at the very top-right of the window, in other words opposite to the close button. I will like to know if that can be removed or change?
Thanks for the help.

How Do I Remove A Picture From A Form?
how embarrassing

I'm making an application that is nothing more than a tiny graphic image you can drag around your desktop with your left mouse button and get a menu with a right click (no problems so far) but I wanted to make the form invisible (still not managed to do it) so that all you could see was my movable graphic image.

Anyway I thought that by adding a transparent gif to the form that it would make it work (it didn't) and now I have no idea how to remove the image from the form, it lets you add one easily enough from the form properties but there doesn't seem to be anything to remove it!!

Add/remove Picture Boxes On The Fly
I'm doing a little personal development in my spare time and I just realized that I have never attempted to create objects dynamically. I'm hoping that it's possible...

In my app, I want to be able to create copies of picture boxes on the fly. In design-time, I have two picture boxes. They're in an array. What I would like to happen is, during run-time, create a copy of one of the two boxes and add it to the array. I would also like to be able to remove this new box. It will never be in the middle of the array, rather I will add/remove to/from the end of the array.

Is this possible? Can anyone point me in the right direction?

How Do I Remove A Picture From My Form?
Well, I'm making a "Space Invaders" style game, and I just coded the aliens part as a grid of labels I drew with some code as an array. The way it works is that the labels are made transparent, like they're pixels. It worked okay, so I decided to add a background image to the form. No for some reason, I can't see anything when I run the program I think the problem is that when the labels are drawn they go behind the image or something. Now I think I'd rather remove the background image, unless someone can tell me how to get it to work with the background image.... which would be preferable..... and without the use of API, or else I'm gonna have to remove it. The problem is that once you put a freakin image on a form, VB doesn't allow you to remove it unless you're replacing it with another image. Any help would be greatly appreciated. Thanks!

How To Remove Picture From Form
In the properties of my form1 I added a picture. How do I remove/change this???

Form1.picture ??????


Remove Cell Picture From MSFlexGRid
How can I remove the cell picture once it is already shown in a cell?
Now I'm using Image control with no picture to do that.


Remove Picture Of Toolbar Buttons
I have attached some pictures to toolbar button via imagelist control but now I want to remove those pictures. In the imagelist property when I select an image and click remove picture a message popup " Image list cannot be modofied while another control bound to it." How can I remove those pictures?

Remove Speckles Or Picture Noise
I 'm looking for vb6 code to remove speckles/noise from multicolor large pictures (up to 8MB), this is to improve unclear and dotted pictures escpecially from digital camera.
All tips appriciated.


Remove Border On Button With Picture
I have a togglebutton with a gif on it. I would like to have the image stretched all over the togglebutton - how can I do that?
Now it's like a border around the picture with the backgroundcolor of the button. Iäve tried to change the size of the image but the border is still there.
See the picture attached....


Remove A Picture Pasted Into A Richtextbox
I made a module for all kinds of stuff related to a richtextbox. One of the subs I did uses the clipboard to paste a picture into a rtb...
Public Sub InsertPicture(ByRef rtb As RichTextBox, _
                         pic As StdPicture)
    ' Use clipboard to insert a picture
    Clipboard.SetData pic
    SendMessage rtb.hwnd, WM_PASTE, 0, 0
    ' Usage example:
    'InsertPicture RichTextBox1, _
    ' LoadPicture("Path/Filename.jpg")
End Sub

I need to make a sub that will remove the picture but I am not sure how...would the SelText property select a picture that has been pasted in the control?

God Bless America

Run Access Macro From Excel Macro

I am using Microsoft Office 2000 and trying to run an Access macro from an Excel macro, but my Excel macro does not seem to be working. When I run the Excel macro, nothing happens - I do not get an error and the code does not do what it is suppossed to. Below is my code:

Sub DisplayForm()
' Initialize string to database path.
Const strConPathToSamples = "C:Miscell est.mdb"

strDB = strConPathToSamples & "test.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strConPathToSamples
' Run Access macro.
appAccess.DoCmd.RunMacro "Macro1", 1
End Sub
I have included the references to "Microsoft DAO 3.6 Object Library" and "Microsoft Access 9.0 Object Library."
Any help on this subject would be much appreciated.

Lotus Macro To Excel Macro Please Help!!
I know nothing about Lotus but I need to convert Lotus macro to Microsoft Excel. Can anyone help

Remove A Picture From A Picture Box?
How do I remove a picture from a picturebox?

How Do I Remove An Image From The Picture Property At Design Time? (Resolved)
I placed an image at the Picture property of a form, and now I need to remove it (go back to (None)). How do I do this at design time? This one is driving me crazy.

Placing A Picture BEFORE Text In A Macro
This is a macro (below) attached to a toolbar button.
I wish to place my sig (jpeg) BEFORE the text.
The code below doesn't do it.

Also if I just use the code
ActiveDocument.InlineShapes.AddPicture Range:=Selection.Range, _
FileName:="C:My DocumentsMy_Sig.jpg"

on its own the cursor stays in front of the picture instead of below
it which is what I would also like.

Any solutions :-)

Thank You
Tim Nicholls
Gelong, Victoria, Australia

Sub All()

ActiveDocument.InlineShapes.AddPicture Range:=Selection.Range, _
FileName:="C:My DocumentsMy_Sig.jpg"

Selection.TypeText Text:="Bill Bloggs"
Selection.TypeText Text:="123 Main St"
Selection.TypeText Text:="Australia"

End Sub

Picture Within Auto Open Macro
Would someone please show me the VBA code to let a picture stay 5 seconds within the Auto Open macro??


Excel VB Macro Invoked By Customized Button Not Moved When Excel File Is Copied && Pasted
hello....the thing is I wrote a macro in an excel file which get's invoked when a customized button is when I copy and past this excel file, the button in the new excel file still keeps pointing to the macro in the old file and only the macro in the old file is invoked again.....can anybody tell me how to resolve this problem?

Possible To Launch A UserForm In Excel From Startup Macro Without Showing Excel?
Greetings to all VBA/Excel Excperts!

I have a project at work that is requiring me to utilize Excel/VBA (something I'm not super-conversant in) and I am wondering if it is possible to have a UserForm be the first thing that pops up when you launch (i.e. double click on) a spreadsheet (likely an .xlt but not necessarily)? I know I can have an Autostart Macro (or something of that ilk) that could launch the form, but I am hoping there is a way to do this so that it just looks like I launched the UserForm and am not firing up the entire Excel program.

As soon as the functionality encapsulated in the UserForm is completed it will shut down Excel, which is why I'd rather just have the form and nothing else.

My reason for doing this is to make deployment of this "application" simple - just drop the spreadsheet onto the target system (which of course must have Excel 2003 installed, which all of our company systems do) and double click. Saves having to create an install package for a plain ole VB app.

Thanks for any suggestions and/or taunts you may have!

How To Create Report In Word Format Through Excel Or Excel Macro
I want to create one Report in Word document Format through Excel.
I have some Data in excel.Now How can I create report in word format using Macro or any other feature, if yes then How ??
Can anyone help me in solving this.
Thanks a ton !!!

Want To Write An Excel Macro That Automaticaly Closes Excel When Finished.
HELP!!! I am trying to get excel to close itself down after a macro has run but have no idea how to do it. I can get it to save&close the current spreadsheet but thats it. Can anybody please help?

Whats The Vb Code To Close Excel Within Excel Using A Macro
i need the code to close excel within excel using a macro and saving all of the changes.

please help//


Emailing Excel Files Via Outlook Using An Excel Macro
Ok maybe this is an easy one for someone out there.

My goal is to write a macro within Excel to automatically grab a file, attach it to an email and send it from Outlook. I know this can be done. I currently have a copy of a macro that will do this exact sequence but through Lotus Notes instead of Outlook. My hang up has to be with the communication between the two programs.

This is what I have currently (Excel to Lotus Notes):

Const embed_attachment As Integer = 1454
Dim session As Object
Dim db As Object, doc As Object, ws As Object, rtitem As Object
Dim CurRow As String
Dim Recipient As Integer
Dim special As String, location As String, ext As String


'Establishes Notes session using server and .nsf file
'Server and sender must be the person sending the email
server = Cells(2, 2)
Sender = Cells(3, 2)

Set session = CreateObject("Notes.NotesSession")
Set ws = CreateObject("Notes.NotesUIWorkspace")
Call ws.opendatabase(server, Sender)
Set db = session.GetDatabase(server, Sender)

'Begins the mail loop for the number of recipients
Recipient = 8
send_to = Cells(Recipient, 2)
Set doc = db.CreateDocument()
doc.savemessageonsend = True
subject_out = Cells(4, 2)
Message = Cells(5, 2)
Message2 = Cells(6, 2)
special = Cells(Recipient, 3)

doc.sendto = send_to
doc.Subject = subject_out
doc.returnreceipt = "1"

Set rtitem = doc.CREATERICHTEXTITEM("Body")
Call rtitem.APPENDTEXT(Message)
Call rtitem.ADDNEWLINE(2)
Call rtitem.APPENDTEXT(Message2)
Call rtitem.ADDNEWLINE(3)

location = "h:Monthly BudgetsColumnarxls"

'Reads filenames and attaches files until it reaches the end of the file list
z = 4
file = Cells(Recipient, z)

Call rtitem.EmbedObject(embed_attachment, "", location & file & ext & ".xls")
z = z + 1
file = Cells(Recipient, z)
Loop Until IsEmpty(file) = True

'Sends file, resets doc variable to empty, and advances to next recipient

Call doc.Send(False)
Call doc.Save(True, False)

Set doc = Nothing
Recipient = Recipient + 1
send_to = Cells(Recipient, 2)

Loop Until IsEmpty(send_to) = True

'Sets variable to empty to save on memory
Set session = Nothing
Set db = Nothing
Set ws = Nothing
Set rtitem = Nothing

End Sub




Delete An Excel File With An Excel Macro

Did any know if I can delete an excel file with an excel macro? (the file is not the ones that I am, instead is one in the same directory).

Any suggestions I'll appreciated it

Question From Excel Or Excel Macro Gurus

i really want to now that is there is any utility/way or wizard through which i can make my interface on Excel just like this
here i m trying to display my interface which wil be on sheet or user forum

TextBox1 Textbox3
TextBox2 TextBox4

Button--- Add ---.Display result in TextBox4

and Run time Change on TextBox3[that will automatically add textbox1 & textbox2 and display in [Textbox3]

but i want to do this without coding is their is way or wizard in Excel Macro to Do this Please Confirm me this thing is it possible without codind i just want to do this without coding

Somebody told me that through Excel we can do this as Front Page Make WebPage & made their code automatically

Please Reply me about this Question

Thanks in Anticipation


Excel 2K Need To Remove Every Other Column
Hi All,

I'm writting a macro to convert the formatting of some spreadsheets, some sheets have only 4 columns, others have over 200. I've written a crude way to delete every other column, but its not flexible.

' Step 6 - Deleting Qualifier Columns

Selection.Delete Shift:=xlToLeft
Can any one suggest a better way to delete every other Column starting at column 'C'?

Since some spreadsheets will have only a handful of columns, and others will have close to the limit (220? I think is excel's limit). I've been trying to figure out how to write an expression that will avoid the columns I want and only select 'ever other' column.

Any help would be appricated.

How To Remove VBA-code From Excel Using VBA?

Is it possible to remove all VBA-code that is present behind worksheets and in separate code modules, by using some sort of VBA-statement?

My Excel 97 file contains a lot of VBA code to generate itself based on an Access database.

The end result is then distributed to other people, therefor I want/need to remove all code automatically once it is generated.

Is there an easy way to do this, using VBA?

Thanks in advance

Remove Duplicates In Excel
Hi all,

I have a excel with 1000 cells of some sort of text let say Name. I want to remove duplicates. How can I do that?

If I run a macro on it, it should remove all duplicate Names. All the names should come only once.



Remove Excel From Memory...
I have an app that creates a form in Excel. I used an example that I found on here to get started on this. Everything works great... it creates the excel file and everything is perfect.

Problem is, it does not quit out of excel until I exit my app despite having all the removal procedures:

VB Code:
xlApp.DisplayAlerts = False        wkbNewBook.Close SaveChanges:=True, FileName:=xlsfilename        End With 'for workbook        xlApp.Quit     Set wkbNewBook = Nothing    Set xlApp = Nothing

I don't get it. I need Excel to close in case someone wants to run another report while the app is still running.

Any ideas??

How To Remove References In VBA (Excel)?
I am trying to remove a reference in vba in excel. I am using the following code:

Private Sub Refresh_Click()

Dim Success As Boolean
Success = True

Call RegReference(Success)

If Success = True Then
    Call ScriptFolder
End If

End Sub

Private Function RegReference(Success As Boolean)

On Error GoTo ErrorRoutine

Dim RefPat, RefName
RefName = "DS: OLE Document Properties 1.4 Object Library"
RefPath = Application.ActiveWorkbook.Path & "dsofile.dll"

With ActiveWorkbook.VBProject.References
.Remove ThisWorkbook.VBProject.References(RefName)
    .AddFromFile (RefPath)
End With

Exit Function

Select Case Err.Number
Case 32813: Resume Next
Case 48: MsgBox "The reference object required to execute this command - 'dsofile.dll' cannot be found. " & _
                    "The file should reside in the same folder as this spreadsheet!"
Case Else: MsgBox "you have encountered an error - error number " & Err.Number & " - " & ". " & _
End Select

Success = False

End Function

The line in bold is causing a "Subscript out of range" error - error number 9. I have searched the web and cant find a solution to the problem. The reference is definately there!

Can anyone help please?


How To Remove Excel .exc From Memory
Hello friends,
i am doing a project , in that i have to genarate excell report.
i did it very finelybut problem arises that the excel file is created but even if i close that file and not saved , it remains in memory.
i used .........

Dim xclApp As New Excel.Application
Dim xclWorkbook As Excel.Workbook
Dim xclSheetA As Excel.Worksheet
Dim xclRangeA As Excel.Range.... etc
insert all record to excel object and finaly called...

xclApp.Visible = True
ActiveWindow.Zoom = 50

after this command excel **** genarates but even though i close it without saving its remain in memory and ask me to save or not when i shut down the PC.
Thanks in advance
Hoping Best from u!!!

Remove Blank Excel WorkSheet
Hi All,

How to delete blank(no data) worksheet in Excel programatically--(using VB.NET or C#).

Kindly respond!.Thanks in Advance.


Cannot Remove Excel From Task Manager
Cannot Remove Excel from Task Manager ...?

How To Remove Columns From An Excel File
Dear People,

How can I write a little app or macro to remove certain columns from an excel file? I know there is some kind of API for excel. Where I can find info about it?

I need to run this little app or macro in excel when the desired file is open.

I'll appreciate your help.

Luis F Hernandez
Carlsbad, CA

Excel Chart - Paste Special As Picture In Excel Itself
Hi All,

I am working on a report and it needs to be generated daily. After generating and creating charts, I need to paste special those charts as "Pictures". Is there any way to do this? And also i need to paste special every single chart in the work book. I already done a code but it not working properly.. and the important point is i need to paste special the chart at the exact position where i intended to cut. Is this possible???

Pls treat this as emergency and advice me on this.

Thanks in advance..


Programatically Remove Links Within Word To Excel.
I have a word document that has content linked to some
cells in excel. by that i mean, i copied from excel and
did a paste special with links. I can manually break these
links in word if i go to edit -> links and break all the
links. Is there a way of doing this through a macro. I
tried recording the link breaking procedure but nothing
showed up in the macro. The word vba help has an example
of where it shows how to break links but that seems to
work only for objects and not text.

thanks in advance

Remove Garbage Data From Excel Sheet
I am trying to retrive data from from an excel sheet and insert
in access database. sometimes excel sheets return garbage data as well like the last rows are not used but they are returned. i can check if they are null and remove them but i would like to know if there is a vb routine with which instead of checking null i can remove the rows which are garbage.

Copyright © 2005-08, All rights reserved