ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Insert Picture question (https://www.excelbanter.com/excel-programming/277084-simple-insert-picture-question.html)

Paul

Simple Insert Picture question
 
If I record a macro, it looks like this:

ActiveSheet.Pictures.Insert("C:\Photos\3078.JPG"). Select

Obviously, I want to make the "3078.JPG" a variable that
I create by selecting a cell from a list of many JPGs. I
tried:

AAA=Activecell.Value
ActiveSheet.Pictures.Insert("C:\Photos\" & AAA

I also tried ActiveSheet.Pictures.Insert
Filename="C:\Photos\" & AAA

Neither worked. I must be getting the syntax wrong.

TIA
paul






Bob Phillips[_5_]

Simple Insert Picture question
 
Paul,

Both of these work for me

AAA = ActiveCell.Value
ActiveSheet.Pictures.Insert Filename:="C:\Photos\" & AAA

AAA = ActiveCell.Value
ActiveSheet.Pictures.Insert "C:\Photos\" & AAA

Are you sure you are including the .jpg in the cell value?

--

HTH

Bob Phillips

"Paul" wrote in message
...
If I record a macro, it looks like this:

ActiveSheet.Pictures.Insert("C:\Photos\3078.JPG"). Select

Obviously, I want to make the "3078.JPG" a variable that
I create by selecting a cell from a list of many JPGs. I
tried:

AAA=Activecell.Value
ActiveSheet.Pictures.Insert("C:\Photos\" & AAA

I also tried ActiveSheet.Pictures.Insert
Filename="C:\Photos\" & AAA

Neither worked. I must be getting the syntax wrong.

TIA
paul









All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com