VBA Excel Adding pictures to a worksheet

0 votes

I discovered some code that enables the user to select which image should be added to a worksheet. Instead, I was hoping it would select and insert a certain image—more precisely, the corporate logo. Here is the key:

PicLocation = Application.GetSaveAsFilename("C:\Work\test_Project\", "CA_Value_AVM, *.jpg", 1)
If PicLocation <> "" Then
    ActiveSheet.Pictures.Insert(PicLocation).Select
Else
    Exit Sub
End If

This code is executed when a button is clicked. The user clicks it and then the path "C:\Work\test_Project\" is opened and the user has to click the picture. I need this to change so that the user doesn't click anything.

Jan 3 in Others by Kithuzzz
• 27,740 points
47 views

1 answer to this question.

0 votes

It should work as:

ActiveSheet.Pictures.Insert("C:\Work\test_Project\myjpgfile.jpg").Select

As that's all the function is returning anyway.

answered Jan 3 by narikkadan
• 51,240 points

Related Questions In Others

0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 22,940 points
110 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,640 points
274 views
0 votes
1 answer

Excel VBA : HOW TO PRINT THE TEXT IN A CELL (like Wrap Text)

Use a LineFeed character to create a ...READ MORE

answered Oct 27, 2022 in Others by narikkadan
• 51,240 points
172 views
0 votes
1 answer

Creating a function in excel VBA to calculate the average point in a circular set of numbers

I used the following code to determine ...READ MORE

answered Oct 28, 2022 in Others by narikkadan
• 51,240 points
142 views
0 votes
1 answer

Convert image (jpg, png, jpeg) to base64

Try this - it will perform the ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 51,240 points
202 views
0 votes
1 answer

How to insert a picture into Excel at a specified cell position with VBA

Try this: With xlApp.ActiveSheet.Pictures.Insert(PicPath) With ...READ MORE

answered Oct 24, 2022 in Others by narikkadan
• 51,240 points
397 views
0 votes
1 answer

Trying to create an enclosing bookmark after pasting a picture from Excel into Word using VBA

Try this: Sub IMPORT_TO_WORD() Dim ws1 As Worksheet, ws2 ...READ MORE

answered Oct 30, 2022 in Others by narikkadan
• 51,240 points
101 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
522 views
0 votes
1 answer

Excel-VBA - How to identify Target range (more than 1 cell) is deleted in a Worksheet_Change function?

You misunderstand the purpose of the function ...READ MORE

answered Sep 23, 2022 in Others by narikkadan
• 51,240 points
1,070 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP