Loading Data from File ~~!!~~

I

Iceage

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 !~~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top