File location / Version errors

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Two questions.

I have an excel tool that I want to distribute to 10 people. I had simply
planned on burning it to a CD and giving them directions on copying the
files. There are two files. The .xls file and a .gif file that is just a
logo that makes the printout look better.

Question #1

I need to know how to refer to the current directory in my script so that I
can call the logo. I planned on instructing the users to copy the xls and
the gif file to my documents but since the path to "my documents" varies
from machine to machine I need to know what to do so the file always shows
up.

Here is the code that works on my machine.
ActiveSheet.PageSetup.CenterHeaderPicture.Filename = _
"C:\Documents and Settings\Sales\My Documents\My Pictures\logo.gif"

This leads to my second Question

Question #2

This macro was written using excel 2002. The above command doesn't seem to
work (even with a proper path) when using excel 2000 eventhough the Visual
Basic is the same version (6.3). The following command also doesn't work.


With ActiveSheet.PageSetup
.PrintErrors = xlPrintErrorsDisplayed

There are other commands in this "With" that seem to work just fine. If I
rem out that line everything seems to go fine.

To be honest I am not even sure if I need that command, it was created using
macro recorder.

Any push in the proper direction would be greatly appreciated.

BTW to all that have helped me get this up and running I offer my sincere
thanks. Elephant doesn't taste so bad with a bit of ketchup.

Michael
 
if you tell them to put the logo and xls file in the same directory

ActiveSheet.PageSetup.CenterHeaderPicture.Filename = _
Thisworkbook.path & "\" & "logo.gif"

Excel 2000 and xl97 don't support printing pictures in the header. So the
above will cause an error in versions earlier than xl2002


Same for you second command. xl2000 and earlier didn't support the little
error icons in the cells. (you should be able to delete that particular
command).
 
Hi Michael

You can use Thisworkbook.Path if the xls and the gif are in the same folder

ActiveSheet.PageSetup.CenterHeaderPicture.Filename = _
ThisWorkbook.Path & "\logo.gif"


Read the VBA help on PrintErrors and you can find out if it is important for you
 
Back
Top