Solved

Click a button to import a template

Posted on 2011-03-17
6
242 Views
Last Modified: 2012-05-11
Hi, I need help. I am going to add a button on an excel file. Then by clicking it, then I can read a template(a worksheet). Need VBA codes.

Thanks.
0
Comment
Question by:zhshqzyc
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:KnutsonBM
Comment Utility
can you post the worksheet you are working with and provide a little more detail of what you are trying to do?

Brandon
0
 
LVL 41

Expert Comment

by:dlmille
Comment Utility
Ok - here's you a starting point where it prompts you for one to many files to open.  There's an internal loop if you want to do any processing on those file(s).  This is a bit more complex than a simple file open, but readily usable to most of my applications.

Sub OpenWorkbooks()
Dim fname As Variant
Dim fnWkb As Workbook


               
        fname = OpenMultipleFilesFCN(True)

        If IsArray(fname) Then
               
            For i = LBound(fname) To UBound(fname)
                Workbooks.Open Filename:=fname(i), UpdateLinks:=2, ReadOnly:=1
            Next i
        End If
ThisWorkbook.Activate
Sheets("Control Panel").Activate

End Sub

it uses an open multiple files function set that's embedded and sourced in the 2nd module (you can open one to many or cancel out)
Cheers,

Dave
Open-Selected-Workbooks-r1.xlsm
0
 
LVL 41

Expert Comment

by:dlmille
Comment Utility
PS - note the command button is an Active-X control that you can edit, if you go into Developer mode, you can double click on it to get to the call to the function listed in my prior post.

Please advise if further assistance is needed.

Dave
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:zhshqzyc
Comment Utility
Okay. I attached two files. One is 384-96-Template.xls, the second one is 384-96 Conv.xls.
Now I add a button to the 384-96 Conv.xls. By clicking it, it will read 384-96-Template.xls. The 384-96-Template.xls has three columns. The 384-96 Conv.xls has five columns. The column C,D and E contains the template. What I want to is after I clicking the button, than write the template columns to the file 384-96 Conv.xls somewhere. And also add two columns which are the first column and second column, The condition is to find the row in template match the  column C,D and E.
Ex, template
Q1	g	8

Open in new window

Then
We have to write
Q1	g	8   M   15

Open in new window

384-96-Template.xls
384-96-Conv.xls
0
 

Author Comment

by:zhshqzyc
Comment Utility
I already have some VBA code there.
0
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
Comment Utility
I posted a solution that met the OP objective, and ahead of the OP finding a solution on his/her own.  Some consideration of Asker even in the form of explanation is desired, given the time spent trying to give a helping hand.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

11 Experts available now in Live!

Get 1:1 Help Now