Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
importing a scanned image | Excel Discussion (Misc queries) | |||
problems with importing an image | Excel Discussion (Misc queries) | |||
VBA to display image on a form - image is defined in Range Name | Excel Programming | |||
Importing an Image (jpeg) in Excel | Excel Programming | |||
Export the worksheet background image as an image file - possible? | Excel Programming |