Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Can you help me solve!

I need to IMPORT an worksheet named "Report" in a workbook called
SendCom.xls. that is updated each day. The worksheet that I am trying to
update is called "sendcom" in
a workbook called GraphSendCom. I attempted doing this with the following
Macro but it does not work. It keeps coming up with "File Not Found" for
sendcom.xls

Any help would be greatly appreciated.

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
Was this


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Can you help me solve!

Krefty,

An idea: you can create a query to the worksheet you want to import, and
write code to update the query on Workbook_Open

"Krefty" wrote:

I need to IMPORT an worksheet named "Report" in a workbook called
SendCom.xls. that is updated each day. The worksheet that I am trying to
update is called "sendcom" in
a workbook called GraphSendCom. I attempted doing this with the following
Macro but it does not work. It keeps coming up with "File Not Found" for
sendcom.xls

Any help would be greatly appreciated.

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
Was this


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Let's see if you can solve this. Sean[_2_] Charts and Charting in Excel 5 June 7th 07 05:14 PM
How do I solve for x? Joanna Excel Worksheet Functions 4 January 22nd 07 03:01 PM
need help to solve this klaengur Excel Discussion (Misc queries) 2 May 9th 06 09:09 AM
y i cannot solve it ? cjjoo Excel Worksheet Functions 2 September 26th 05 11:37 AM
is there anything to solve this? Emty Excel Worksheet Functions 1 January 27th 05 08:19 PM


All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"