ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set 'insert picture' default open location (https://www.excelbanter.com/excel-programming/422273-re-how-set-insert-picture-default-open-location.html)

Jack B. Pollack

How to set 'insert picture' default open location
 
Thank you. This was helpful


"Peter T" <peter_t@discussions wrote in message
...
It looks like the default picture folder is found from an API and seems

that
can't be changed. Following does similar albeit more work.

Sub test()
Dim oldDir As String
Dim lookFldr As String
Dim vFile

lookFldr = "C:\" ' << change

oldDir = CurDir
ChDir lookFldr
'Err.Clear
' add more picture extensions as required
vFile = Application.GetOpenFilename("Picture
Files,*.jpg;*.bmp;*.tif;*.gif", , _
"Insert your wonderful picture in cell " &

ActiveCell.Address(0,
0))
If VarType(vFile) = vbString Then
ActiveSheet.Pictures.Insert vFile
ElseIf VarType(vFile) = vbError Then
MsgBox "GetOpenFilename failed"
Else
'if vfile = false user cancelled
End If

ChDir oldDir
End Sub

Regards,
Peter T

"Jack B. Pollack" wrote in message
...
Hi,

using application.dialogs( xldialoginsertpicture) to open a dialog box.
How
can I control the path that the dialog box open with?








All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com