r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[All] except covered in other channels

[unknown: 5]
31-Jul-2008
[2881]
I'm looking at MSDN in the COM section and browing thru - I look 
days away from learning how to do this.
BrianH
31-Jul-2008
[2882x2]
Well, there you go. Look in MSDN in the Office API section.
Which version of Excel?
[unknown: 5]
31-Jul-2008
[2884]
2003
BrianH
31-Jul-2008
[2885]
Start here: http://msdn.microsoft.com/en-us/library/aa272254(office.11).aspx
[unknown: 5]
31-Jul-2008
[2886x2]
I'll check it out.
Thanks Brian.
BrianH
31-Jul-2008
[2888]
The VBA object model is the COM object model, just friendlier.
[unknown: 5]
31-Jul-2008
[2889]
Ok, this is all GREEK to me at this point but checking into it.
BrianH
31-Jul-2008
[2890]
Gotta go. Good luck!
[unknown: 5]
31-Jul-2008
[2891]
Heh, thanks.
[unknown: 5]
1-Aug-2008
[2892x4]
Brian, I got this code for VBA stuff:
Dim xlApp As Object = CreateObject("Excel.Application")
Dim xlWB As Object = xlApp.Workbooks.Open("C:\Path\Filename.xls")
xlWB.Worksheets(1).Select()

xlWB.SaveAs(Filename:="C:\Path\FileName.txt", FileFormat:=-4158, 
CreateBackup:=False)
xlWB.Close()
xlWB = Nothing
xlApp.Quit()
xlApp = Nothing
It looks like it is supposed to automate opening an Excel doc and 
then converting it to save it as a tab-deliminated file which would 
be perfect for me to then use REBOL to parse that file.  However, 
I tried saving this data in file with a .vbs extension but it gives 
me an error after the first line which says "Expected End of Statement". 
 I have no clue how to fix it as this code came off the net.
I'm sure I'm doing something wrong but not sure what that is.
Gregg
1-Aug-2008
[2896x4]
Two things I've done--mention before I believe. One is an Excel control 
dialect. It doesn't let you control everything, and requires a non-REBOL 
DLL I wrote, which is free to use. The other is a send-keys dialect 
that lets you pump keystrokes to apps. You should be able to do the 
above process with that.
The above code looks like regular VB. I never did vbs, so I don't 
know detail differences. For example, you can run VBA in a host app 
(e.g. Excel) that uses it as a macro language, but maybe the command 
prompt doesn't support all the same things, like variable declarations.
It looks like it's just line-wrapping in altme that's breaking the 
lines. VB is line oriented, requiring a line continuation character 
for multiline statements.
Does the WSH give you any other info about the error?
[unknown: 5]
1-Aug-2008
[2900x4]
Yeah it looks like it breaks at the 11 character on line 1.
I actually have another script (its at work) and it uses ADO.  But 
it gives me an error but does seem to out put the data.  I also think 
I have another route which is to record a macro in excel save the 
macro to another workbook and then modify the macro to launch on 
open.  I haven't figured out the code to launch a macro on open of 
the workbook but did find out how to launch a message on open.  So 
I think I'm close.
If I go the macro route then I can use the call command to call excel 
and the macro workbook which will perform actions on the other excel 
file.
kinda ugly way of doing it I suppose but gets the job done.
Brock
2-Aug-2008
[2904x2]
what about  a microsoft tool called Log Parser?  It allows command 
line access to files and can also do things like file format conversions 
and simple manipulations etc.   http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
It's a command-line tool, so could easily call it from Rebol.
Gregg
2-Aug-2008
[2906]
Does VBA under WSH not support typed declarations or inline assignment 
against them?
[unknown: 5]
2-Aug-2008
[2907x3]
Not sure what that means Gregg.
Brock, I gotta use the resources on the machine with the only other 
introduction to be REBOL.
There are major rules against outside software.
Brock
2-Aug-2008
[2910]
Paul, okay, I recall you saying that.  But the fact that the small 
command-line tool is Microsoft, they may look the other way.  Besides, 
I don't know for sure if it would work for you, but may be worth 
taking a look at.
[unknown: 5]
3-Aug-2008
[2911]
I don't think it can read native XLS can it?  Doesn't the XLS file 
still need to be converted first for logparser?
Brock
3-Aug-2008
[2912]
A closer look and no it does not.  I got some of the input and output 
formats confussed.  I thought it could read from a SQL/ODBC data 
source but appears that is only an output format.  There is a COM 
api, but that might be more complex than is worth.
[unknown: 5]
3-Aug-2008
[2913]
After looking at it, I believe someone could easily build a more 
powerful utility using REBOL than what logparser is.
Gregg
3-Aug-2008
[2914]
What I mean is, does it support

Dim xlApp
Dim xlApp As Object
Dim xlApp As Object = CreateObject("Excel.Application")


The first is just a declaration, the second adds a type to it (rather 
than making everything a Variant), and the third adds inline assignment 
to the declared variable.
[unknown: 5]
3-Aug-2008
[2915]
I don't really know much about VBA.
PeterWood
3-Aug-2008
[2916x4]
This is a msft example of calling Excel from VBScript - http://support.microsoft.com/kb/198703/
This one is mainly JScript but shows more examples of controlling 
Excel - http://support.microsoft.com/kb/234774
Both are shown being called from IE but they should also work under 
WSH.
and to answer Gregg's question, it appears to support

	dim app
	set app = createobject("Excel.Application")
[unknown: 5]
4-Aug-2008
[2920]
Thanks Peterwood.  Those seems helpful if I need to just call and 
interact with Excel but I need to actually retrieve rows in an automated 
fashion and be able to parse them in a tab-delimited manner.
[unknown: 5]
13-Aug-2008
[2921]
I have another fantasy football league that is seeking another member. 
 This is USA Football which is different then european football which 
we call soccer.  The fantasy football league is ran via Yahoo.  The 
league fee is only $35 bucks.  Great for those wanting to start their 
first time.  All newcomers draft last but it is a snake order draft 
which means the last person goes first in the every other round. 
   The draft is currently scheduled for Sat Aug 23 9:30am CDT.  Gonna 
be a blast - this is my third year in this league and it is very 
active.  Lots of smack talk in this league but lots of fun.  Serious 
takers only please.  Even if you submit this opening might get filled. 
 I still have the REBOLers league which is wide open.
[unknown: 5]
14-Aug-2008
[2922x3]
This league is now full.
Were at 12 now and we are considering going to 14 but only if we 
can get 14 before draft day.  We had 14 last year and it was ver 
competative due to the lack of player talent to choose from.
So if you have an interest let me know but if your looking for a 
league continue to look elsewhere also.
Gregg
11-Sep-2008
[2925]
New REBOL articles: http://hostilefork.com/
james_nak
11-Sep-2008
[2926]
Interesting article(s). Somehow I figured I would see a Gregg reply. 
 : )
BrianH
11-Sep-2008
[2927]
Another Brian :)
james_nak
11-Sep-2008
[2928]
I was wondering...
Graham
11-Sep-2008
[2929x2]
Looks like he's using an old version of Rebol where forall does not 
reset to head.
http://hostilefork.com/2008/09/05/the-flexible-series-as-a-core-concept-of-rebol/#more-77