Thingol
Technical User
- Jan 2, 2002
- 169
Hi, I'm relatively new to VBA, and I hope someone here may be able to help me with this.
I'm trying to find the location of a file (a bitmap) in Excel. I want to put the bitmap on a commandbutton. It would be simple if the program was going to be used on only my computer. However, it won't be, so I can never be sure in which directory the bitmap I'm looking for will be. I think the DIR function should be able to look up the file (including its path), but I can't figure out how to pull it off. I've tried something like:
Dim Bitmap
Bitmap = Dir("Bitmap.bmp"
msgbox "Location of bitmap: " & CStr(Bitmap)
The msgbox doesn't show a string with the directory where bitmap.bmp is located. Instead it shows "".
What am I doing wrong, and what should I do?
I'm trying to find the location of a file (a bitmap) in Excel. I want to put the bitmap on a commandbutton. It would be simple if the program was going to be used on only my computer. However, it won't be, so I can never be sure in which directory the bitmap I'm looking for will be. I think the DIR function should be able to look up the file (including its path), but I can't figure out how to pull it off. I've tried something like:
Dim Bitmap
Bitmap = Dir("Bitmap.bmp"
msgbox "Location of bitmap: " & CStr(Bitmap)
The msgbox doesn't show a string with the directory where bitmap.bmp is located. Instead it shows "".
What am I doing wrong, and what should I do?