View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
okaizawa okaizawa is offline
external usenet poster
 
Posts: 129
Default Reading complete Excel using DDE code

Hi,

you can select cell range by using excel4 macro function in DDE.
the following is an example for word 2000 vba:

Sub DDE_Test()
Dim ch As Integer, ch2 As Integer
Dim Sel As Variant, Ret As Variant

ch = DDEInitiate("Excel", "System")
DDEExecute ch, "[FORMULA.GOTO(""[Book1.xls]Sheet1!R1C1"")]"
DDEExecute ch, "[SELECT.SPECIAL(5)]" 'select a current region
Sel = DDERequest(ch, "Selection")
Sel = Split(Sel, "!")
DDETerminate ch

ch2 = DDEInitiate("Excel", Sel(0))
Ret = DDERequest(ch2, Sel(1))
'Selection.InsertAfter Ret
DDETerminate ch2
End Sub


the reference on macro function is he

http://www.microsoft.com/downloads/d...0-5d03748ca5cd
http://support.microsoft.com/kb/143466/EN-US/

--
HTH,

okaizawa



amitkrsingh wrote:
Hello All,

I am able to sucessfully read contents of excel file using DDE command
with parameter R1C1:R10C10 i.e. by giving the start and end number of
columns and rows.

What if I dont know the start and the end number and I want to read the
entire document in one go.

Is there a command to read the complete Content of a single sheet from
a excel file in one go ?

I am aware that I could iterate through the rows and columns untill I
stop getting more data but in this particular case it is impractical as
the excel sheet is too large and take about 30 mins to iterate through
it.

Thanks for your help in advance.
-Amit