Change .GetOpenFilename to start in folder that contatins excel document

KYLE05

New Member
Joined
Aug 26, 2014
Messages
4
My macro prompts to selected a picture then rotates and sizes to the selected merged cell. The issue I am having is when I am prompted to select a picture it always starts in my documents folder. The pictures I use are saved in the same folder as their corrisponding excel document. How can I get it to begin the prompt starting in the folder my excel file is saved in? I am using excel 2010 on windows 7. My code is listed below. Any help is appreciated thank you.
The code I use to prompt for a picture is listed below

Sub ROTATE_INSERT_PICTURE()
Dim myPicture As String, myRange As Range
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", _
, "Select Picture to Import")
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Maybe try adding this before the call to GetOpenFilename:

Code:
ChDir ThisWorkbook.Path
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top