R
Roderick O'Regan
I have a userform with a command button. When this button is selected
it first looks for a drive and folder in an INI file.
I use the System.privateprofilestring method for this. All OK so far.
I then want the File Open dialog box to appear and look at the avove
location for users to select a file.
When the user has made the selection and selected the Open command
button I want to trap this filename ("ThisFile", below) and then use
it as follows:
With ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range,
Filename:= _
ThisFile, LinkToFile:=False, _
SaveWithDocument:=True)
....other properties
End With
I've been using the following command, plus a few others, to
complement it in a module where they can be declared:
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
However, it doesn't seem to work in that fashion when written into a
procedure within a userform.
It's the GetOpenFilename that I want to use which is within the
comdlg32.dll library.
How does one do this when a command button is selected wthin a
userform, please?
Or, on the other hand, am I using a sledgehammer to crack a nut?
Regards
Roderick
it first looks for a drive and folder in an INI file.
I use the System.privateprofilestring method for this. All OK so far.
I then want the File Open dialog box to appear and look at the avove
location for users to select a file.
When the user has made the selection and selected the Open command
button I want to trap this filename ("ThisFile", below) and then use
it as follows:
With ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range,
Filename:= _
ThisFile, LinkToFile:=False, _
SaveWithDocument:=True)
....other properties
End With
I've been using the following command, plus a few others, to
complement it in a module where they can be declared:
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
However, it doesn't seem to work in that fashion when written into a
procedure within a userform.
It's the GetOpenFilename that I want to use which is within the
comdlg32.dll library.
How does one do this when a command button is selected wthin a
userform, please?
Or, on the other hand, am I using a sledgehammer to crack a nut?
Regards
Roderick