Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
Yes, But that one still lets user select "All Files" from Files of type
dropdown in file open window, So once they select "All Files" they are able to select word, excel files "JLGWhiz" wrote: 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
If you use the Application.GetOpenFilename method, you can limit the
selection to PDFs only. --JP On Oct 5, 10:58*am, sam wrote: Yes, But that one still lets user select "All Files" from Files of type dropdown in file open window, So once they select "All Files" they are able to select word, excel files |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please Help: Upload a File and save it at a specific location
If you are going to use the dialog box for the user to select from, then you
will not have much choice about how the user manipulates it. But the second macro limits the choices for most novice users. If it does not have a .pdf extension, it will not show in the selection window, unless the user knows to click the file type drop down. Why would they want to do that when the PDF selections should be right in front of them? But you can fix that probability with code that if they select a file < to ..pdf then a message appears that they picked the wrong file type and exit out of the sub. "sam" wrote in message ... Yes, But that one still lets user select "All Files" from Files of type dropdown in file open window, So once they select "All Files" they are able to select word, excel files "JLGWhiz" wrote: 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 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to Save File to specific location when closing | Excel Discussion (Misc queries) | |||
Auto save Spread sheet as htm to a specific location | Excel Discussion (Misc queries) | |||
Macro to Save As to a specific location | Excel Programming | |||
Save to specific location | Excel Discussion (Misc queries) | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming |