Find the filename of header image

M

mjones

Hi All,

I created a spreadsheet last summer that has a logo in the header.
I've got to create another worksheet with the same logo, but I can't
remember which one I used because there are so many in the directory.
Is there any way to find the actual filename of the logo?

The reason there are so many is because Excel prints the image
proportionally different that it's shown on the screen and we tried a
zillion files to figure out the problem before we just gave up and
when with the printout okay and put the logo in the header where no
one can see it until printed.

Thanks,

Michele
 
E

Earl Kiosterud

Michele,

Run this little macro.

Sub GetHeaderFileName()
MsgBox ActiveSheet.PageSetup.LeftHeaderPicture.Filename
End Sub

Change "LeftHeaderPicture" to one of these, as needed, depending on where your picture(s) is
in the header or footer:

CenterHeaderPicture
CenterFooterPicture
LeftHeaderPicture
LeftFooterPicture
RightHeaderPicture
RightFooterPicture
 
M

mjones

Hi Earl,

Worked brilliantly! ... Well, except that I need the extension, too.
I have .jpg, .png and .gif.

I wish I understood how to use the Object Browser. Excuse the newbee
questions, but I see ActiveSheet and PageSetup under that and
LeftHeaderPicture under that, but how do you know to use Filename
under that? And then how to figure out how to add the extension, too?

Thanks again,

Michele
--------

Michele,

Run this little macro.

Sub GetHeaderFileName()
MsgBox ActiveSheet.PageSetup.LeftHeaderPicture.Filename
End Sub

Change "LeftHeaderPicture" to one of these, as needed, depending on where your picture(s) is
in the header or footer:

CenterHeaderPicture
CenterFooterPicture
LeftHeaderPicture
LeftFooterPicture
RightHeaderPicture
RightFooterPicture
--
Earl Kiosterudwww.smokeylake.com







- Show quoted text -

Hi,

Worked brilliantly ... except that I need the extension, too. I
have .jpg, .png and .gif.
 
G

Gord Dibben

Did you try Earl's macro?

Earl's code gives me the path, filename and extension in the message box.

C:\Documents and Settings\Gord\My Documents\My Pictures\screenshot.jpg

I tested with jpg, png and gif............all OK


Gord Dibben MS Excel MVP
 
E

Earl Kiosterud

Gord,

I haven't tried this, but if the Windows folder options are set to "hide extensions of known
file types" as they say, maybe the extension doesn't get reported.
 
G

Gord Dibben

Earl

I thought about that at 4:30AM.............during a sleepless period.

I tested with "hide known file extensions" checked.

No difference at first, but after saving workbook, closing Excel and
re-opening............

Sure 'nough............msgbox returned just the name....no path or extension.

Unchecked the "hide known file extensions".

Saved workbook, closed Excel, re-opened and again, just the name.

Created new workbook with a picture in header and got full path and filename.jpg

Saved workbook, re-opened and just the name appeared.

Flaky behaviour.............once saved and re-opened, msgbox returns name only.


Gord
 
E

Earl Kiosterud

Gord,

That is indeed odd. Excel is generally pretty solid, generally, mostly, which sort of does
a con job so one won't expect such weirdness. But you've gotten to the bottom of it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top