![]() |
Macro with manual file selection?
I would like to create a macro that will insert a manually selected image from specific directory using Excell 2002. In other words I would like to be able to execute a macro that will take me to a predetermined directory and will pause for manual selection of an image file. Using the "Record New Macro" function It is easy to set up a macro that will insert the same image over and over again. ActiveSheet.Pictures.Insert("\\Fileserver\otprints \ADV03(LFM-0900,C).jpg"). _ Select End Sub I'm sure what I am trying to do is more complicated then the simple macro above. Can anyone help me out with this? Thank You, Paul -- Pmedina ------------------------------------------------------------------------ Pmedina's Profile: http://www.excelforum.com/member.php...o&userid=24552 View this thread: http://www.excelforum.com/showthread...hreadid=381679 |
Macro with manual file selection?
This code should give you what you want. Code: -------------------- Sub InsertSelectedPicture() Dim selFile As String Dim myDir As String myDir = "\\Fileserver\otprints" ChDir (myDir) selFile = Application.GetOpenFilename("JPG Files (*.jpg),*.jpg,All Files (*.*),*.*") ActiveSheet.Pictures.Insert (selFile) End Sub -------------------- See VBA help to see the different options for the file filter types that can be used. -- bhofsetz ------------------------------------------------------------------------ bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807 View this thread: http://www.excelforum.com/showthread...hreadid=381679 |
Macro with manual file selection?
bhofsetz, Thanks. You made that look easy. I had no problems using your code. Pau -- Pmedin ----------------------------------------------------------------------- Pmedina's Profile: http://www.excelforum.com/member.php...fo&userid=2455 View this thread: http://www.excelforum.com/showthread.php?threadid=38167 |
All times are GMT +1. The time now is 12:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com