how to specify the filename
i use this macro to import data from a worbook
Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=Αρχεία Excel;DBQ=D:\MY WORKBOOK.xls;DefaultDir=D:;DriverId=790;MaxBufferS ize=20480;PageTimeout=5;" _ , Destination:=Range("A1")) ..CommandText = Array( _ "SELECT `MY SHEET$`.F1, `MY SHEET$`.F3, `MY SHEET$`.F4, `MY SHEET$`.F5, `MY SHEET$`.F6, `MY SHEET$`.F8, `MY SHEET$`.F9, `MY SHEET$`.F10, `MY SHEET$`.F11, `α" _ , _ "γωνιστικές10$`.F13" & Chr(13) & "" & Chr(10) & "FROM `D:\ΟΜΙΛΟΣ 1Γ ΚΑΤΗΓΟΡΙΑΣ`.`MY SHEET$` `MY SHEET$`" _ ) ..Name = "N A M E" ..FieldNames = True ..RowNumbers = False ..FillAdjacentFormulas = False ..PreserveFormatting = True ..RefreshOnFileOpen = False ..BackgroundQuery = True ..RefreshStyle = xlInsertDeleteCells ..SavePassword = True ..SaveData = True ..AdjustColumnWidth = True ..RefreshPeriod = 0 ..PreserveColumnInfo = True ..Refresh BackgroundQuery:=False End With End Sub I want the user to choose the workbook.How can i do it. Thanks in advance. --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 11:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com