+ Reply to Thread
Results 1 to 3 of 3

Macro with manual file selection?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2005
    Posts
    2

    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

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    This code should give you what you want.

    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.

  3. #3
    Registered User
    Join Date
    06-22-2005
    Posts
    2
    bhofsetz,

    Thanks. You made that look easy. I had no problems using your code.

    Paul

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1