Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / excel files... maybe?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. excel files... maybe?
#548
Posted by: 2002-10-14 14:56:57
Is there a way to handle (i.e. put data into) excel files?
Message2. If numeric values only,
#550
Posted by: guidance 2002-10-14 15:45:28
try qxls.zip:
http://citymap.getmyip.com/_scripts/file.php?f=80&r=2330
Message3. Re: excel files... maybe?
#552
Posted by: 2002-10-14 16:54:43
qxls.inc allows to read from excel files, but not to write into them.
Thanks anyway.
Message4. COM?
#555
Posted by: guidance 2002-10-14 19:53:33
RQ doesn't support COM well, but you can try:
http://citymap.getmyip.com/_scripts/file.php?f=2114&r=2330
Message5. Re: excel files... maybe?
#557
Posted by: 2002-10-15 16:55:40
This one seems to do all I need, but I can't make it work properly.
I need to open an existing file, or at least create a new one and save it. I did create a new file, but could save it only in the c:winntsystem32 directory, and I can't move it from there!
This is the code I used, based on excel.bas: where's the bug?

$INCLUDE "RAPIDQ.INC"
$OPTIMIZE ON
$APPTYPE GUI
$TYPECHECK OFF
$ESCAPECHARS ON
DECLARE FUNCTION CopyFile LIB "kernel32" ALIAS "CopyFileA" (ByVal lpExistingFileName AS STRING, ByVal lpNewFileName AS STRING, ByVal bFailIfExists AS LONG) AS LONG
DIM Wndw AS QFORM, ExcelApp AS QOLEOBJECT, ExcelSheet AS QOLECONTAINER
DIM var1 AS VARIANT, var2 AS VARIANT, var3 AS VARIANT
SUB Free_Objects(Action AS INTEGER)
      ExcelSheet.Free
      ExcelApp.Free
        
CopyFile("c:WINNTsystem32exxol.xls","c:RapidQexxol.xls",0)
Kill("c:WINNTsystem32exxol.xls")

     END SUB

     Wndw.Width=600
     Wndw.Height = 400
     Wndw.Center

     ExcelSheet.Parent=Wndw
     ExcelSheet.Width=580
     ExcelSheet.Height=380
     ExcelSheet.Align=alClient
     ExcelSheet.Cursor=crDefault
     ExcelSheet.Color=&H00FF00FF ' Background Colour - Ignore!
     ExcelSheet.SizeMode=smClip ' Ignore/d.
     ExcelSheet.BorderStyle=bsSizeable ' bsSizeable only, otherwise Lock- Out.

 ' Keep the Object invisible until we have created the Object,
' otherwise
 ' you will get the refresh problems noted in the RapidQ QOLECONTAINER
 ' chapter.
     ExcelSheet.AutoShow=0

     ExcelApp.CreateObject("Excel.Application")
     ExcelSheet.CreateObject("Excel.Sheet")

    ' ExcelApp.Container=ExcelSheet ' is this really needed?

     var1=Range("A2").Select
     var2=ActiveCell.FormulaR1C1

     var2="23"

 ' This is the last piece!!...and it's working now ;)
     Excelapp.Cells(2,5) ="23"
     ExcelSheet.Saveas "c:exxol"
     ExcelSheet.Show ' Now show the Object.
     Wndw.OnClose=Free_Objects    
 

     Wndw.ShowModal
Message6. Re: excel files... maybe?
#564
Posted by: 2002-10-17 15:49:20
tricky, isn't it?
Anyway, where can I learn something on QOLEOBJECTS AND CONTAINERS?

Thks
Message7. Re: excel files... maybe?
#570
Posted by: guidance 2002-10-18 10:00:56
I suggest you try VBS for best compatibility with MS-Office:
http://citymap.getmyip.com/Forum/read.php?f=10&i=47&t=47#reply_47
Message8. Re: excel files... maybe?
#586
Posted by: 2002-10-22 03:27:28
Hello Cajino,
Replace your savecommand with this one, i think it will do what you want because it works on my pc. See the double backslash, Excel doesn't know your initial setting $EscapeChars On.
I run Win2k and office xp and it works with me.

    ExcelSheet.Saveas "c:\\exxol"

Wish you succes!

Kind regards,
Andre
Message9. Re: excel files... maybe?
#589
Posted by: 2002-10-22 18:07:34
Wow, it works!!!
Thanks very much, this makes it all much more useful for me.

Cajino
Message10. Re: excel files... maybe?
#591
Posted by: 2002-10-22 22:37:21
Again...
what if I want to open an existing file? ExcelSheet.Open just doesn't work, but I didn't expect it to..
Message11. Re: excel files... maybe?
#598
Posted by: 2002-10-24 13:09:58
I just sent to Guidance the latest version of qxls.zip so be sure to have the latest as when bugs are reported I try to update it to correctly read those files.
I am working on xlsWRITE function which is about 50% done.  Please stay tuned.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-9-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0