Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Importing an image in VBA

Excel 2002. I need to insert a picture (logo) into a header, only on the
first page of a printout. At the present time I am using in my VBA code a
file reference for the picture, "c:\picture.jpg", for example. The problem
is that when I transport the program on to another computer, the reference is
no longer valid. I know I can paste the picture onto a sheet, but how do I
then bring it back into a HEADER, for just one page? or is there another way
to do this?
Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Importing an image in VBA

Try pasting with paste special. Use picture format. try each type until you
get good results.

"JacMar" wrote:

Excel 2002. I need to insert a picture (logo) into a header, only on the
first page of a printout. At the present time I am using in my VBA code a
file reference for the picture, "c:\picture.jpg", for example. The problem
is that when I transport the program on to another computer, the reference is
no longer valid. I know I can paste the picture onto a sheet, but how do I
then bring it back into a HEADER, for just one page? or is there another way
to do this?
Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Importing an image in VBA

As you can probably tell, I'm a newbie with VBA. So, it is possible that my
problem is so trivial that it borders the ridiculous. If so, I apologize.

I can "copy" a picture from one sheet and then paste it on another sheet.
In my case here, I will have a LEFTHEADER where I want to picture to go, and
only on the first page of the document, and also a RIGHTHEADER on the same
first page. So I cannot just paste the picture on the sheet. If I do, when
it prints, the picture will not be in the top left corner of the sheet, but
under the right header, on the left.

I have to find a way to tell VBA where to get that picture. I can refer to
a specific file ("C:\...\...picture.jpg"), but as I said before, the moment I
move to another computer, I have to either make sure the picture is in the
correct location, or modify the VBA code. I'm looking for a way to have the
picture "travel" with the VBA code.

Thanks again.

"Joel" wrote:

Try pasting with paste special. Use picture format. try each type until you
get good results.

"JacMar" wrote:

Excel 2002. I need to insert a picture (logo) into a header, only on the
first page of a printout. At the present time I am using in my VBA code a
file reference for the picture, "c:\picture.jpg", for example. The problem
is that when I transport the program on to another computer, the reference is
no longer valid. I know I can paste the picture onto a sheet, but how do I
then bring it back into a HEADER, for just one page? or is there another way
to do this?
Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Importing an image in VBA

Unlike Word, Excel headers are placed on every sheet. This link might help:

http://www.mcgimpsey.com/excel/subs/firstfooter.html

Regards,

Alan

"JacMar" wrote in message
...
Excel 2002. I need to insert a picture (logo) into a header, only on the
first page of a printout. At the present time I am using in my VBA code a
file reference for the picture, "c:\picture.jpg", for example. The
problem
is that when I transport the program on to another computer, the reference
is
no longer valid. I know I can paste the picture onto a sheet, but how do
I
then bring it back into a HEADER, for just one page? or is there another
way
to do this?
Thanks in advance.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Importing an image in VBA

Thanks Alan:

The difficulty is not to print the header only on the first page, it is
related to the fact that I will have a PICTURE as a Header. I am writing a
macro, and I have taken care of the problem of not printing the headers on
every page. It is relatively easy to print different headers and footers on
different pages, using VBA. I also know how to print a picture as a header.
But the reference to that picture is of the form : "C:\. . . .jpg". This
means that if I move the Excel workbook, with the VBA code, to another
computer, it does not find the picture, unless I make sure to copy it in the
required location on the new computer. I want to have the picture as part of
the VBA code, if that is possible.

"Alan" wrote:

Unlike Word, Excel headers are placed on every sheet. This link might help:

http://www.mcgimpsey.com/excel/subs/firstfooter.html

Regards,

Alan

"JacMar" wrote in message
...
Excel 2002. I need to insert a picture (logo) into a header, only on the
first page of a printout. At the present time I am using in my VBA code a
file reference for the picture, "c:\picture.jpg", for example. The
problem
is that when I transport the program on to another computer, the reference
is
no longer valid. I know I can paste the picture onto a sheet, but how do
I
then bring it back into a HEADER, for just one page? or is there another
way
to do this?
Thanks in advance.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Importing an image in VBA

Since your path statement points to your local drive, it renders it useless
unless you have the path shared for all users.

If the two are kept in the same folder, use ThisWorkbook.Path or
ActiveWorkbook.Path to locate the picture file. You can send it as a zip
package to be unzipped into the same folder.

Or, you can store it in the workbook, hidden or otherwise.

Storing it on a network drive is the most convenient; if you have that
capability and everyone has access to a common drive. Everyone in my office
uses some of my modules which access logos and such on the network.

Regards,

Alan


"JacMar" wrote in message
...
Thanks Alan:

The difficulty is not to print the header only on the first page, it is
related to the fact that I will have a PICTURE as a Header. I am writing
a
macro, and I have taken care of the problem of not printing the headers on
every page. It is relatively easy to print different headers and footers
on
different pages, using VBA. I also know how to print a picture as a
header.
But the reference to that picture is of the form : "C:\. . . .jpg". This
means that if I move the Excel workbook, with the VBA code, to another
computer, it does not find the picture, unless I make sure to copy it in
the
required location on the new computer. I want to have the picture as part
of
the VBA code, if that is possible.

"Alan" wrote:

Unlike Word, Excel headers are placed on every sheet. This link might
help:

http://www.mcgimpsey.com/excel/subs/firstfooter.html

Regards,

Alan

"JacMar" wrote in message
...
Excel 2002. I need to insert a picture (logo) into a header, only on
the
first page of a printout. At the present time I am using in my VBA code
a
file reference for the picture, "c:\picture.jpg", for example. The
problem
is that when I transport the program on to another computer, the
reference
is
no longer valid. I know I can paste the picture onto a sheet, but how
do
I
then bring it back into a HEADER, for just one page? or is there
another
way
to do this?
Thanks in advance.






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
importing a scanned image Julie Excel Discussion (Misc queries) 4 August 24th 07 05:00 PM
problems with importing an image Todd Excel Discussion (Misc queries) 0 January 29th 07 10:10 PM
VBA to display image on a form - image is defined in Range Name Tan Excel Programming 4 May 17th 06 03:37 PM
Importing an Image (jpeg) in Excel Hubert Rétif Excel Programming 1 June 8th 05 01:24 PM
Export the worksheet background image as an image file - possible? DataFreakFromUtah Excel Programming 2 April 10th 04 04:49 PM


All times are GMT +1. The time now is 11:20 PM.

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"