Macro does its own thing.

K

Krefty

I created the following MACRO to import a daily updated Workbook called
"sendcom.xls". I am able to see it perform the update but then a pop up
window comes up and says" File Not Found" with a file name of sendcom.xls.
If I go and locate the sendcom.xls file it still does not allow me to close
the window and if I select cancel it closes the importing file and populates
the sendcom sheet in the GraphSendCom workbook but the problem is that it
creates it own cell spacing causing additional links worksheets in the
GraphSendCom to no work correctly.

Thanks for anyhelp.



Sub main()

Dim destCell As Range
Dim totConspWkbk As Workbook

With Workbooks("GraphSendCom.xls").Worksheets("sendcom")
.UsedRange.Clear
Set destCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

Workbooks.OpenText Filename:="G:\Gas_Control\EXCEL\DEPT\EOD @ Web
Reports\@ Web SendCom\sendcom.xls", _
Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(8, 1), _
Array(30, 1), Array(41, 1), Array(67, 1), Array(78, 1))

Set GraphSendCom = ActiveWorkbook

ActiveSheet.UsedRange.Copy _
Destination:=destCell

GraphSendCom.Close savechanges:=False

Application.Goto destCell, Scroll:=True

ActiveSheet.UsedRange.Columns.AutoFit
Close
End Sub
 

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