Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to use the content of a cell as a file name

I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to use the content of a cell as a file name

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to use the content of a cell as a file name

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY


"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to use the content of a cell as a file name

A typo.

Try:
ActiveSheet.Pictures.Insert(sName).Select



cyrus wrote:

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY

"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to use the content of a cell as a file name

It's funny how how a four letter word can change everything! You just saved
me a bunch time. Thank you so much


Regards,
--
CY


"Dave Peterson" wrote:

A typo.

Try:
ActiveSheet.Pictures.Insert(sName).Select



cyrus wrote:

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY

"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY




--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to use the content of a cell as a file name

Dave, Tom

Sorry to bug you. I left out one minor detail. In need to do this for every
sheet except sheet named(Cover). All the formula cells and cells for Pic
insertions are the same range for every sheet.

Thanks a million
--
CY


"Dave Peterson" wrote:

A typo.

Try:
ActiveSheet.Pictures.Insert(sName).Select



cyrus wrote:

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY

"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY




--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to use the content of a cell as a file name

Dim wks as worksheet

for each wks in activeworkbook.worksheets
with wks
select case lcase(.name)
case is = "cover"
'do nothing
case else
.select
.Range("E2:H18").Select
sName = .Range("A1").Text
.Pictures.Insert(sName).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#
end select
end with
next wks

Maybe???????

cyrus wrote:

Dave, Tom

Sorry to bug you. I left out one minor detail. In need to do this for every
sheet except sheet named(Cover). All the formula cells and cells for Pic
insertions are the same range for every sheet.

Thanks a million
--
CY

"Dave Peterson" wrote:

A typo.

Try:
ActiveSheet.Pictures.Insert(sName).Select



cyrus wrote:

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY

"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY




--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to use the content of a cell as a file name

Tom,

That worked Great.
Thanks again,
--
CY


"cyrus" wrote:

I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HDI set cell content as the default file name for a new Excel wb Allouette Excel Discussion (Misc queries) 5 March 29th 09 01:22 PM
link cell content to another file blackstar Excel Discussion (Misc queries) 2 April 4th 06 03:20 AM
Assign Cell Content As File Name [email protected] Excel Programming 2 October 18th 05 06:42 PM
Save as using cell content in file name NickMinUK Excel Programming 1 June 15th 04 10:06 AM
Automatic File Name based on cell content Prangk Excel Programming 2 April 3rd 04 10:43 PM


All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"