+ Reply to Thread
Results 1 to 8 of 8

Inserted picture name

  1. #1
    DaveJones
    Guest

    Inserted picture name

    Hello
    I have inserted a small version of a picture onto a spreadsheet. I've then
    linked a macro that opens a userform with a frame on it that displays a
    bigger version of the picture when you click on it. This works if I
    physically put the path name of the picture in the code. Can I pick up in the
    code the name of the picture on the spreadsheet as I am going to have
    multiple small pictures on the spreadsheet and would like to only access one
    sub to load it onto the userform.

    Regards
    DaveJones

  2. #2
    Tom Ogilvy
    Guest

    Re: Inserted picture name

    I don't believe this information is available as there is no link from the
    picture to the file once it is inserted. However, you could just hardcode
    the reference to the file in your code.

    --
    Regards,
    Tom Ogilvy


    "DaveJones" <[email protected]> wrote in message
    news:[email protected]...
    > Hello
    > I have inserted a small version of a picture onto a spreadsheet. I've then
    > linked a macro that opens a userform with a frame on it that displays a
    > bigger version of the picture when you click on it. This works if I
    > physically put the path name of the picture in the code. Can I pick up in

    the
    > code the name of the picture on the spreadsheet as I am going to have
    > multiple small pictures on the spreadsheet and would like to only access

    one
    > sub to load it onto the userform.
    >
    > Regards
    > DaveJones




  3. #3
    DaveJones
    Guest

    Re: Inserted picture name

    Tom
    What I was trying to do was pick up the name of the picture on the
    spreadsheet as it appears in the namebox ie "Picture1" and then use this name
    to load the picture onto the userform. So I would name the files on my hard
    drive Picture1 etc and then use this variable in the code ie
    loadpicture("c:\+Picture1+".jpg") or something similar. So I wouildn't need
    to know the original name.Any ideas?!

    Regards
    DaveJones

    "Tom Ogilvy" wrote:

    > I don't believe this information is available as there is no link from the
    > picture to the file once it is inserted. However, you could just hardcode
    > the reference to the file in your code.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "DaveJones" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello
    > > I have inserted a small version of a picture onto a spreadsheet. I've then
    > > linked a macro that opens a userform with a frame on it that displays a
    > > bigger version of the picture when you click on it. This works if I
    > > physically put the path name of the picture in the code. Can I pick up in

    > the
    > > code the name of the picture on the spreadsheet as I am going to have
    > > multiple small pictures on the spreadsheet and would like to only access

    > one
    > > sub to load it onto the userform.
    > >
    > > Regards
    > > DaveJones

    >
    >
    >


  4. #4
    Peter T
    Guest

    Re: Inserted picture name

    Maybe you could store the fullpath of the bigger version in the
    AlternativeText property of the small worksheet picture.

    In the macro

    sPath = ActiveSheet.Shapes(Application.Caller).AlternativeText

    Simplest is if sPath is a public variable to be read during the forms
    initialize event, though there are other ways without using a public var.

    Regards,
    Peter T



    "DaveJones" <[email protected]> wrote in message
    news:[email protected]...
    > Hello
    > I have inserted a small version of a picture onto a spreadsheet. I've then
    > linked a macro that opens a userform with a frame on it that displays a
    > bigger version of the picture when you click on it. This works if I
    > physically put the path name of the picture in the code. Can I pick up in

    the
    > code the name of the picture on the spreadsheet as I am going to have
    > multiple small pictures on the spreadsheet and would like to only access

    one
    > sub to load it onto the userform.
    >
    > Regards
    > DaveJones




  5. #5
    Tom Ogilvy
    Guest

    Re: Inserted picture name

    You can get that in the code fired by the picture:

    sName = Application.Caller

    sStr = "C:\" & sName & ".jpg"

    --
    Regards,
    Tom Ogilvy



    "DaveJones" <[email protected]> wrote in message
    news:[email protected]...
    > Tom
    > What I was trying to do was pick up the name of the picture on the
    > spreadsheet as it appears in the namebox ie "Picture1" and then use this

    name
    > to load the picture onto the userform. So I would name the files on my

    hard
    > drive Picture1 etc and then use this variable in the code ie
    > loadpicture("c:\+Picture1+".jpg") or something similar. So I wouildn't

    need
    > to know the original name.Any ideas?!
    >
    > Regards
    > DaveJones
    >
    > "Tom Ogilvy" wrote:
    >
    > > I don't believe this information is available as there is no link from

    the
    > > picture to the file once it is inserted. However, you could just

    hardcode
    > > the reference to the file in your code.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "DaveJones" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hello
    > > > I have inserted a small version of a picture onto a spreadsheet. I've

    then
    > > > linked a macro that opens a userform with a frame on it that displays

    a
    > > > bigger version of the picture when you click on it. This works if I
    > > > physically put the path name of the picture in the code. Can I pick up

    in
    > > the
    > > > code the name of the picture on the spreadsheet as I am going to have
    > > > multiple small pictures on the spreadsheet and would like to only

    access
    > > one
    > > > sub to load it onto the userform.
    > > >
    > > > Regards
    > > > DaveJones

    > >
    > >
    > >




  6. #6
    DaveJones
    Guest

    Re: Inserted picture name

    Thanks Peter
    I used sPath = ActiveSheet.Shapes(Application.Caller).Name
    This picked up which picture I had clicked on and loaded the relevant
    picture from the hard disk. All working fine!
    Regards
    DaveJones

    "Peter T" wrote:

    > Maybe you could store the fullpath of the bigger version in the
    > AlternativeText property of the small worksheet picture.
    >
    > In the macro
    >
    > sPath = ActiveSheet.Shapes(Application.Caller).AlternativeText
    >
    > Simplest is if sPath is a public variable to be read during the forms
    > initialize event, though there are other ways without using a public var.
    >
    > Regards,
    > Peter T
    >
    >
    >
    > "DaveJones" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello
    > > I have inserted a small version of a picture onto a spreadsheet. I've then
    > > linked a macro that opens a userform with a frame on it that displays a
    > > bigger version of the picture when you click on it. This works if I
    > > physically put the path name of the picture in the code. Can I pick up in

    > the
    > > code the name of the picture on the spreadsheet as I am going to have
    > > multiple small pictures on the spreadsheet and would like to only access

    > one
    > > sub to load it onto the userform.
    > >
    > > Regards
    > > DaveJones

    >
    >
    >


  7. #7
    Peter T
    Guest

    Re: Inserted picture name

    If you only want the name go with the simpler code Tom suggested

    s = ActiveSheet.Shapes(Application.Caller).Name
    s = Application.Caller

    will both return the same

    Regards,
    Peter T

    "DaveJones" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks Peter
    > I used sPath = ActiveSheet.Shapes(Application.Caller).Name
    > This picked up which picture I had clicked on and loaded the relevant
    > picture from the hard disk. All working fine!
    > Regards
    > DaveJones
    >
    > "Peter T" wrote:
    >
    > > Maybe you could store the fullpath of the bigger version in the
    > > AlternativeText property of the small worksheet picture.
    > >
    > > In the macro
    > >
    > > sPath = ActiveSheet.Shapes(Application.Caller).AlternativeText
    > >
    > > Simplest is if sPath is a public variable to be read during the forms
    > > initialize event, though there are other ways without using a public

    var.
    > >
    > > Regards,
    > > Peter T
    > >
    > >
    > >
    > > "DaveJones" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hello
    > > > I have inserted a small version of a picture onto a spreadsheet. I've

    then
    > > > linked a macro that opens a userform with a frame on it that displays

    a
    > > > bigger version of the picture when you click on it. This works if I
    > > > physically put the path name of the picture in the code. Can I pick up

    in
    > > the
    > > > code the name of the picture on the spreadsheet as I am going to have
    > > > multiple small pictures on the spreadsheet and would like to only

    access
    > > one
    > > > sub to load it onto the userform.
    > > >
    > > > Regards
    > > > DaveJones

    > >
    > >
    > >




  8. #8
    DaveJones
    Guest

    Re: Inserted picture name

    Thanks All
    Easy when you know how!

    "Peter T" wrote:

    > If you only want the name go with the simpler code Tom suggested
    >
    > s = ActiveSheet.Shapes(Application.Caller).Name
    > s = Application.Caller
    >
    > will both return the same
    >
    > Regards,
    > Peter T
    >
    > "DaveJones" <[email protected]> wrote in message
    > news:[email protected]...
    > > Thanks Peter
    > > I used sPath = ActiveSheet.Shapes(Application.Caller).Name
    > > This picked up which picture I had clicked on and loaded the relevant
    > > picture from the hard disk. All working fine!
    > > Regards
    > > DaveJones
    > >
    > > "Peter T" wrote:
    > >
    > > > Maybe you could store the fullpath of the bigger version in the
    > > > AlternativeText property of the small worksheet picture.
    > > >
    > > > In the macro
    > > >
    > > > sPath = ActiveSheet.Shapes(Application.Caller).AlternativeText
    > > >
    > > > Simplest is if sPath is a public variable to be read during the forms
    > > > initialize event, though there are other ways without using a public

    > var.
    > > >
    > > > Regards,
    > > > Peter T
    > > >
    > > >
    > > >
    > > > "DaveJones" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > Hello
    > > > > I have inserted a small version of a picture onto a spreadsheet. I've

    > then
    > > > > linked a macro that opens a userform with a frame on it that displays

    > a
    > > > > bigger version of the picture when you click on it. This works if I
    > > > > physically put the path name of the picture in the code. Can I pick up

    > in
    > > > the
    > > > > code the name of the picture on the spreadsheet as I am going to have
    > > > > multiple small pictures on the spreadsheet and would like to only

    > access
    > > > one
    > > > > sub to load it onto the userform.
    > > > >
    > > > > Regards
    > > > > DaveJones
    > > >
    > > >
    > > >

    >
    >
    >


+ 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