Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get data from other xls

I need to get data from one xls document (the data is in a txt box) into
another xls document.
How do i open one xls and look into it for the txt box from another?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default get data from other xls

1. I suppose you have a reference to an Excel application object.
Using this reference you can open a workbook targeting the other xls file.

or

2. Create a new reference to an Excel application object and open a workbook
which targets the xls file.

"polilop" wrote in message
...
I need to get data from one xls document (the data is in a txt box) into
another xls document.
How do i open one xls and look into it for the txt box from another?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default get data from other xls

"polilop" wrote in message
...
I need to get data from one xls document (the data is in a txt box) into
another xls document.
How do i open one xls and look into it for the txt box from another?


I do this by (in code) opening the other xls, copying what I want, pasting
values into the one I'm working with then closing the source file. There's
probably a more technically correct way but this works for me. Here's one I
think I posted here recently:

Sub GetDataFromFile()
Application.ScreenUpdating = False
Worksheets("Data").Range("A2:J2000").ClearContents
Worksheets("Data").Activate
Range("A1").Select

If Not CBool(Len(Dir("I:\Accounting\Daily Tonnes\DataFiles\" &
Range("Date") & " ALL.xls"))) Then
MsgBox "There is no Data File called:" & Chr(13) & Range("Date") & "
ALL.xls" & Chr(13) & "Check that you have typed the date correctly above," &
Chr(13) & "and that the file has been saved in the correct location.", ,
"****** Trap!"
Worksheets("Main").Select
Range("date").Select

Exit Sub

Else
If Not CBool(Len(Dir("I:\Accounting\Daily Tonnes\DataFiles\" &
Range("Date") & " HMC.xls"))) Then
MsgBox "There is no Data File called:" & Chr(13) & Range("Date") & "
HMC.xls" & Chr(13) & "Check that you have typed the date correctly above," &
Chr(13) & "and that the file has been saved in the correct location.", ,
"****** Trap!"
Worksheets("Main").Select
Range("date").Select

Exit Sub

Else


Workbooks.Open ("I:\Accounting\Daily Tonnes\DataFiles\" & Range("date") & "
ALL")
Workbooks(Workbooks.Count).Activate

ActiveSheet.UsedRange.Copy
Workbooks("Daily Tonnes Model.xls").Activate
Range("PasteSpot").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Workbooks(Workbooks.Count).Close
Workbooks("Daily Tonnes Model.xls").Activate

Workbooks.Open ("I:\Accounting\Daily Tonnes\DataFiles\" & Range("date") & "
HMC")
Workbooks(Workbooks.Count).Activate

ActiveSheet.UsedRange.Copy
Workbooks("Daily Tonnes Model.xls").Activate
Range("HMCPasteSpot").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Workbooks(Workbooks.Count).Close

Workbooks("Daily Tonnes Model.xls").Activate
Sheets("Main").Select
Range("Date").Select

Application.ScreenUpdating = True
MsgBox "Got it", , "Daily Tonnes"

End If
End If

End Sub


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
Data Labels- POssible to show data value and data label together? kippers Charts and Charting in Excel 1 April 1st 09 01:33 PM
Increase Your Business By Data Conversion, Data Format and Data EntryServices in India Data Entry India Excel Worksheet Functions 1 March 31st 08 12:51 PM
Save 20% On Data Conversion and Data Formats Services by Data EntryIndia Data Entry India Excel Discussion (Misc queries) 0 March 31st 08 12:00 PM
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing [email protected] Excel Discussion (Misc queries) 0 March 20th 08 12:45 PM
MULTIPLE DATA - How to insert new data into existing data.... Rodorodo Excel Discussion (Misc queries) 0 December 15th 06 11:50 PM


All times are GMT +1. The time now is 09:42 AM.

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

About Us

"It's about Microsoft Excel"