View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Iceage Iceage is offline
external usenet poster
 
Posts: 2
Default 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 !~~