Solved

Click a button to import a template

Posted on 2011-03-17
6
244 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
ID: 35158702
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
ID: 35158718
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
ID: 35158726
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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:zhshqzyc
ID: 35158979
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
ID: 35158988
I already have some VBA code there.
0
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 35159822
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

770 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