Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, i need a macro to import another xls file.When i run macro i need a
window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try some code like the following:
Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, i have some problems.
The code run corectly and browse for whatever file i need, but when i click that file, it doesn;t import anything! What am i doing wrong? I have excel 2003. Thanks! "Chip Pearson" a scris: Try some code like the following: Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! . |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Chip's code shows you how to get the name of the file from the user. It doesn't
do the actual import. You'll have to add that portion yourself -- or explain what you're doing in greater detail. puiuluipui wrote: Hi, i have some problems. The code run corectly and browse for whatever file i need, but when i click that file, it doesn;t import anything! What am i doing wrong? I have excel 2003. Thanks! "Chip Pearson" a scris: Try some code like the following: Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! . -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, i just want to import an xls file, but thru an macro, and after i import
the file, i will add some codes myself. I need to hit a button linked to an macro and the macro to open an browse window. I will select the file i need, hit ok and the excel to import in active sheet, that file. After this, the macro will format the content, but this is another problem i will deal with later. I only need the macro to import a file by browsing after it. Can this be done? Thanks! "Dave Peterson" a scris: Chip's code shows you how to get the name of the file from the user. It doesn't do the actual import. You'll have to add that portion yourself -- or explain what you're doing in greater detail. puiuluipui wrote: Hi, i have some problems. The code run corectly and browse for whatever file i need, but when i click that file, it doesn;t import anything! What am i doing wrong? I have excel 2003. Thanks! "Chip Pearson" a scris: Try some code like the following: Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! . -- Dave Peterson . |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What do you mean by "import"? The code I posted will display the file
open dialog to prompt you to select the file. Once that is complete, you need to open the file: Dim WB As Workbook Set WB = Application.Workbooks.Open(Fname) where FName is the file name selected in the Open dialog. Beyond that you need to explain just you mean by "want to import an xls". Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Thu, 1 Apr 2010 06:28:08 -0700, puiuluipui wrote: Hi, i just want to import an xls file, but thru an macro, and after i import the file, i will add some codes myself. I need to hit a button linked to an macro and the macro to open an browse window. I will select the file i need, hit ok and the excel to import in active sheet, that file. After this, the macro will format the content, but this is another problem i will deal with later. I only need the macro to import a file by browsing after it. Can this be done? Thanks! "Dave Peterson" a scris: Chip's code shows you how to get the name of the file from the user. It doesn't do the actual import. You'll have to add that portion yourself -- or explain what you're doing in greater detail. puiuluipui wrote: Hi, i have some problems. The code run corectly and browse for whatever file i need, but when i click that file, it doesn;t import anything! What am i doing wrong? I have excel 2003. Thanks! "Chip Pearson" a scris: Try some code like the following: Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! . -- Dave Peterson . |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Opening a file does not "import" it into anything.
What portion of that opened file do you need imported to an active workbook? That's what you need to describe. Gord Dibben MS Excel MVP On Thu, 1 Apr 2010 06:28:08 -0700, puiuluipui wrote: Hi, i just want to import an xls file, but thru an macro, and after i import the file, i will add some codes myself. I need to hit a button linked to an macro and the macro to open an browse window. I will select the file i need, hit ok and the excel to import in active sheet, that file. After this, the macro will format the content, but this is another problem i will deal with later. I only need the macro to import a file by browsing after it. Can this be done? Thanks! "Dave Peterson" a scris: Chip's code shows you how to get the name of the file from the user. It doesn't do the actual import. You'll have to add that portion yourself -- or explain what you're doing in greater detail. puiuluipui wrote: Hi, i have some problems. The code run corectly and browse for whatever file i need, but when i click that file, it doesn;t import anything! What am i doing wrong? I have excel 2003. Thanks! "Chip Pearson" a scris: Try some code like the following: Sub AAA() Dim FName As Variant Dim Filter As String ' Excel 2003 workbooks Filter = "Excel Files (*.xls),*.xls" ' Excel 2007 workbooks workbooks Filter = "Excel Files (*.xlsx;*.xlsm;*.xlsb),*.xlsx;*.xlsm;*.xlsb" ' Excel 2003 and 2007 Filter = "Excel Files (*.xls;*.xlsx;*.xlsm;*.xlsb),*.xls;*.xlsx;*.xlsm;* .xlsb" FName = Application.GetOpenFilename(filefilter:=Filter) If FName = False Then Debug.Print "cancel" Else Debug.Print "selected: " & FName End If End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 31 Mar 2010 14:00:01 -0700, puiuluipui wrote: Hi, i need a macro to import another xls file.When i run macro i need a window to appear and to browse to the file i need to import. I allways open another file, so i want to browse for the file. Can this be done? Thanks! . -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
import file so that it is a actual csv file, no excel cell version | New Users to Excel | |||
import data from txt file to an existing excel file | Excel Discussion (Misc queries) | |||
Skipping Import Text File dialog in a Macro | Excel Discussion (Misc queries) | |||
How come I can't import an .svc file(Open Office) to Excel file? | Excel Discussion (Misc queries) | |||
Would Like to Automate Batch File Creation and Text FIle Import | Excel Discussion (Misc queries) |