View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John Garate John Garate is offline
external usenet poster
 
Posts: 7
Default change folder

Troy,
I'ts when I change the line of code to "TEXT;C:\EMP4\Tab files for Excel\EM
Church Schedule.tab",
that the macro hangs. The only thing Ive done is change EMP3 to EMP4.
I know I could repeat using the MacroRecorder, but this is a diddicult
process because of the query. I was hoping to just to edit the code.

John



"TroyW" wrote in message
...
John,

Disregard the previous information that I gave. It looks like you used the
MacroRecorder to record importing a file using the "Data | Import External
Data | Import Data..." command from the menubar.

You will need to modify the following line of code in
"ImportChurchSchedule":

From: "TEXT;C:\EMP3\Tab files for Excel\EM Church Schedule.tab",

To: "TEXT;C:\EMP4\Tab files for Excel\EM Church Schedule.tab",

Or you could repeat using the MacroRecorder to record importing the file
from it's new location

Troy

"John Garate" wrote in message
...
Troy,
I'm not sure what you are telling me. I really just starting to learn to
use
visual basic. I don't see the querytables commands you refer to. I've
pasted
a copy of the macro into this email.



Sub ImportChurchSchedule()
'
' ImportVisitSchedule Macro
' Macro recorded 2/11/2005 by Jag
'

'
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\EMP3\Tab files for Excel\EM Church Schedule.tab",
Destination:=Range( _
"B3"))
.Name = "EM Visit Schedule"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
End Sub
Sub FormateDateColumn()
'
' FormateDateColumn Macro
' Macro recorded 2/11/2005 by Jag
'

'
Columns("B:B").Select
Selection.NumberFormat = "mm-dd"
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = False
End With
Selection.NumberFormat = "mmm-dd"
Range("F14").Select
End Sub
Sub InsertData()
'
' InsertData Macro
' Macro recorded 2/11/2005 by Jag
'

'
Application.Run "ImportVisitSchedule"
Application.Run "SetColumnWidths"
Application.Run "FormateDateColumn"
End Sub

Public Sub Auto_Open()
Application.WindowState = xlMaximized
End Sub