ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loading Data from File ~~!!~~ (https://www.excelbanter.com/excel-programming/317651-loading-data-file-%7E%7E-%7E%7E.html)

Iceage

Loading Data from File ~~!!~~
 
Hi,
I just can't seems to load the data from a file using macros.
Part of my program is below. Basically i just want to use the macro to load
a file with the name form the inputbox from the current directory.

But i just can't able to do it. I even tried to fix the directory but still
invain. Think something wrong with my synatx ???

Anyone able to help ??


MyValue = InputBox(Message, Title, Default)

'For Loading the file
If MyValue = "None" Then
MyValue = "None"
Else
'Edit Sheet Name
Sheets("Sheet1").Select
Sheets("Sheet1").Name = MyValue

MyValue2 = "C:\Project FOM\Excel\" + MyValue + ".dat"

Range("B1").Select
With ActiveSheet.QueryTables.Add(Constants:= _
MyValue2, Destination:=Range("B1"))
.Name = MyValue
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False

......

Thanx in advance !~~


All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com