View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Please Help: Upload a File and save it at a specific location

It looks to me like that is what Macro2 does. Did you read the post where
it says:

OR if you want to filter this by PDF files you can try the below macro



"sam" wrote in message
...
Thanks a lot for your help Jacob, Is it possible to desin it such that
they
can only upload pdf files and no other format? I want them to see only pdf
files, so they cannot upload files with any other format..

Thanks in advance

"Jacob Skaria" wrote:

Hi Sam

On button click you can try the below two options

Sub Macro1()
Dim varFile As Variant, strDestFolder As String

strDestFolder = "J:\Files"
varFile = Application.GetOpenFilename
If varFile = False Then Exit Sub

'Copy File
FileCopy varFile, strDestFolder & _
Mid(varFile, InStrRev(varFile, Application.PathSeparator))

End Sub

OR if you want to filter this by PDF files you can try the below macro

Sub Macro2()
Dim varFile As Variant, strDestFolder As String

strDestFolder = "J:\Files"

With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Filters.Add "Adobe Acrobat", "*.pdf", 1
.InitialFileName = "C:\"
.Show
If .SelectedItems.Count = 0 Then Exit Sub
varFile = .SelectedItems(1)
End With

'Copy File
FileCopy varFile, strDestFolder & _
Mid(varFile, InStrRev(varFile, Application.PathSeparator))

End Sub



If this post helps click Yes
---------------
Jacob Skaria


"sam" wrote:

Hi All,

Is there a way to upload a file through excel userform? I am looking to
upload a PDF file throug a userform I have designed.

For eg, Designing a "Browse" button on the form, which on clicking will
display a window where users can select the file they want to submit
and
upload it? So once they select a file and click "Submit" button on the
userform, the selected file is saved at a specific location on a shared
drive.

Is this possible?

Thanks in Advance