Solved

VBA code to ask user to choose source data from a location

Posted on 2016-09-23
5
24 Views
Last Modified: 2016-10-20
Hello experts,

Can anyone provide me a vba code that I use it in a custom button to ask the user to get the source data from a folder / location?

I am trying to create an automate report and the users should be able to choose new raw data from a location.

thanks,
0
Comment
Question by:tony01excel tony
5 Comments
 
LVL 13

Assisted Solution

by:John Tsioumpris
John Tsioumpris earned 250 total points
ID: 41812220
i think you need to read the documentation of FileDialog
Here is small sample in Access VBA
Dim fd As FileDialog
Dim ffs As FileDialogFilters
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
        Set ffs = .Filters
        With ffs
            .Clear
            .Add "Text RAW", "*.csv", 1
        End With
.AllowMultiSelect = False
        If .show = False Then Exit Sub

FullFilePath = .SelectedItems(1)
End With

Open in new window

0
 
LVL 33

Expert Comment

by:Norie
ID: 41812221
Is the source data a workbook or is it something else?
0
 

Author Comment

by:tony01excel tony
ID: 41812225
Hi Norie,

Source data will be another excel workbook, but saved in the same folder as the automated template.
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 41812260
Hi,

pls try

ChDir ActiveWorkbook.Path
strFileToOpen = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*")
If strFileToOpen = False Then Exit Sub

Open in new window

Regards
1
 
LVL 14

Expert Comment

by:frankhelk
ID: 41851710
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Rgonzo1971 (https:#a41812260)
-- John Tsioumpris (https:#a41812220)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now