Help using OLE from a PB executable (PB 6.5)

I copied this from a suggestion found in this NG on how to convert
datawindow to Excel - by saving to HTML (to get computed fields etc), then
converting to Excel format using OLE.

When I run from within PB, it works fine - the file "docname"
is in Excel format.

But when I build the application and run from an EXE, the Excel logic
doesn't seem to do anything - the
resulting file still looks in HTML format.

I am wondering if I need to add something to the Resource file to get this
OLE to work from executable?

The code is as follows (where "ds" is a DataStore):

// begin code sample

// Save as HTML format

 if ds.SaveAs(docname, HTMLTable!, True) = -1 then
     MessageBox("Warning", "Unable to export data. Error writing to file!",
 end if

 // Convert HTML file to Excel native format

 OLEObject excel
 excel = CREATE OLEObject
 li_rtn = excel.ConnectToObject(docname)
 if li_rtn = 0 then
    excel.application.DisplayAlerts = TRUE

..Name).Visible = True
    excel.application.workbooks(1).saveas(docname, 39)
  MessageBox("Error","OLE ConnectToObject return code = " +
end if


// end code sample

Anyhelp is appreciated.


12/17/2001 10:35:10 AM
sybase.powerbuilder.general 62418 articles. 18 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 17

This works (don't ask me why is it a global function:-) :

global function integer gf_save_dw_as_excel (datawindow p_dw)

string  ls_html_name, ls_html, ls_html_parse
integer         li_filenumber, li_bytes, li_loop, li
integer         li_rc
long            ll_stringlen, ll_start, LL_EXCEL_STANDARD_FILE_TYPE
ulong ll_handle, ll_rc 
string          ls_rc
oleobject       lole_excel, lole_workbook
//Pointer               OldPointer
// Get The directory in which to save the report
string   ls_dir, ls_file
li_rc = GetFileSaveName('Save As Excel', ls_dir,ls_file, 
IF li_rc = 0 THEN RETURN -1

IF FileExists(ls_dir) THEN FileDelete(ls_dir)

// the Saveas htmltable! only worked up until the html table reached 83K. 
After that
// different "stuff" appears in the stylesheet property.  By doing a 
filewrite this
// problem was elimanated.

li = Len(ls_dir)
ls_html_name    = Mid(ls_dir, 1,li - 4) + ".htm"

ls_rc = p_dw.Modify("datawindow.htmlTable.generateCSS = 'yes'") 
ls_rc = p_dw.Modify("datawindow.htmlTable.nowrap = 'no'") 

ls_html                         = 
ll_stringlen    = len(ls_html) 

If ll_stringlen > 32765 Then
        If Mod(ll_stringlen, 32765) = 0 Then
                li_loop = ll_stringlen / 32765
                li_loop = (ll_stringlen / 32765) + 1
        End if
        li_loop = 1
End if

li_fileNumber   = FileOpen(ls_html_name, Streammode!, Write!, 
LockReadWrite!, Replace!)

IF li_fileNumber >= 0 THEN
        ll_start = 1
        FOR li = 1 to li_loop
        ls_html_parse = Mid(ls_html,ll_start,32765) 
        IF FileWrite(li_filenumber, ls_html_parse) = -1 THEN
                RETURN -1
        END IF
        ll_start += 32765
        RETURN -1

//  lole_excel is a standard user object of type oleobject
lole_excel      = create oleobject

li_rc   = lole_excel.ConnectToNewObject("excel.application")

IF li_rc <> 0 THEN
        destroy lole_excel
        RETURN -1

lole_workbook =
IF NOT ISValid(lole_workbook) THEN
        destroy lole_excel
        RETURN -1

//delete html file !!!!!!!!!
IF fileexists(ls_html_name) THEN

destroy lole_excel 
end function

12/17/2001 6:50:25 PM

Similar Artilces:

What to upgrade my PB 6.5 to PB 6.5.1 ?
What to upgrade my PB 6.5 to PB 6.5.1 ? What file I can download and Where is this file ? thanks On Thu, 5 Aug 1999 23:03:18 +0800, in powersoft.public.powerbuilder.database Netvigator <> wrote: >What to upgrade my PB 6.5 to PB 6.5.1 ? What file I can download and Where >is this file ? > >thanks > > --- Bruce Armstrong [TeamSybase] | Romac/Source International | ...

Informix + PB 6.5: which I-Net for PB 6.5?
Hi, I want to migrate our PB4/ PB 5.01 16 bit Informix applications to 32bit. Which version of CLI/I-Connect and which PB 6.5 build do you recomend me? We are using 7.13 and 7.30 OnLine. TIA Pepa PS. I need ISO 8859.2 <-> ISO latin 2 (1250) conversion. We use the latest INFORMIX-Connect v 7.2 drivers for our PB 6.5 apps. These drivers are available for free download (actually INFORMIX-Client SDK, of which INFORMIX-Connect is the runtime component) from the Informix website ...

What to upgrade my PB 6.5 to PB 6.5.1 ?
What to upgrade my PB 6.5 to PB 6.5.1 ? Where I can donwload the upgrade pack ? thanks Go to select Software Distribution, log on, select Powerbuilder and then pick PB 6.5.1 maintenance patch. Harpreet Netvigator wrote in message ... >What to upgrade my PB 6.5 to PB 6.5.1 ? Where I can donwload the upgrade >pack ? > >thanks > > Go to Sybase Developers Network ( and look for the patches link. Good luck, Terry [TeamSybase] and Sequel the techno-kitten On Thu, 5 Aug 1999 23:02:22 +0800, &quo...

Can the PB 6.5 or 6.5.1 maintenance release be ran on PB 6.0
Yes. ...

PB 7.0 or PB 6.5 or PB 6.0 or PB5.04
We are using PB 5.04 Enterprise at this moment and are almost happy (uch) with it. Because we don't programming applications for the Internet (maybe in the near future) we haven't upgraded to version 6.0 and 6.5. Now we are confused what to do, keeping the old and 'stable' version (5.04) or upgrading to a newer version. Are there features in the newer versions wich make it a 'must' to upgrade. What are this features. Or are there reasons to stay on 5.04 (buggy newer versions?). What is doing the rest of the Powerbuilder world??? Greetings, Hans Groeneveld ...

PB 6.5 datawindow using ora 8.x sp using pb 7.3 dll
Hi, We are having Oracle 8.x setup on Windows NT. We have develop an application in Power builder 6.5 using oracle store procedure. When we run the application ,connection is established to oracle server using pb 7.3 drivers. But as soon as we access the datawindow which uses store procedures It gives Windows NT Dr Watson Error. I am not able to trace out this error message. I like to connect PB6.5 to Oracle 8.x with pb6 oracle 8 dll. If any one can specify from where I can download this files. Waiting for reply. Thanks Rahul Rahul 1. I use the O73 driver in 6.5 ...

PB 6 and PB 6.5 Upgrade to PB 8.0 in OS W2K Professional
PB 6 and PB 6.5 crash in OS W2K Professional: I notice that I need to upgrade to 6.5.1 as well as EBF 1299. However, I am only able to get 6.5.1. Where can I get the optionally patch EBF 1299? Is there any document to indicate any known problem in OS W2K for 6.0 and 6.5? PB 6 and PB 6.5 Upgrade to PB 8.0: Can be upgrade from 6.0 and/or 6.5 directly to 8.0? Is 8.0 support WIN XP? Regards. Set your timeframe to 'ALL' on While that is the most current build, it was released at least over 6 months ago (the default timeframe of this site)...

Experiences with PB 6.5.1 vs. PB 6.5.0
Any people run into any problems with 6.5.1 (+ EBF 1163) that were not there in vanilla 6.5.0. We have to migrate very late in the game (1 week before going live!) due to problems with 6.5.0 Oracle drivers and I would appreciate any advice on anything that got broken in that release. TIA, -- -------------------------------------------------------------------- Jacek Furmankiewicz STS Systems - --------------------------------------------------------------------- 6.51 introduces a peculiar side effect during update() of datawindow - scrolls the d...

PB 6.5.0 vs PB 6.5.1 with datastores
Hi all, I began developing a large application using PB 6.5.0 several months ago. For various reasons, we had to migrate the code to 6.5.1. After performing some recursion testing, we noticed that many operations involving datastores ( create, insert rows, update, destroy ) began generating random GPF/Page Faults. The code itself hasn't changed and was verified in PB 6.5.0 via extensive testing. This is a hard one to pinpoint since the crashing is somewhat random. I've read some posts that indicate that certain dot notation can be problematic. All objects were fully rebuilt...

Migration From PB 5 to PB 6.5
Hello I am developing applicatons in PB from last three years, I am using PB 5.0.4 now I am planning to migrate on PB 6.5 or PB 7.00. Can anybody tell me what additional advantages I will get after switching from PB 5 to PB 6.5 or PB 7. I preffer I used PB 6.5 or PB 6.5.1 instead of PB 7 because I listen some users that PB 7 having some problems, Is it right? Thanks Haroon (Senior Programmer) Highnoon Laboratories Limited You're in the wrong newsgroup. This one deals with Infomaker only. Use powersoft.public.powerbuilder.general. PB6...

Cannot use SQl Sample Database 5.0 after updating to 6.5 PB... pls help
Please help. What is going on ? This is the errors DBENG50 caused an invalid page fault in module KERNEL32.DLL at 0177:bff9d709. Registers: EAX=c00300ec CS=0177 EIP=bff9d709 EFLGS=00010216 EBX=00000005 SS=017f ESP=0060feb4 EBP=00610150 ECX=00000000 DS=017f ESI=00610238 FS=4ee7 EDX=00000028 ES=017f EDI=00610254 GS=0000 Bytes at CS:EIP: 53 8b 15 dc 9c fc bf 56 89 4d e4 57 89 4d dc 89 Stack dump: Is it possible that the 5.0 database was upgraded? I'm just thinking out loud here.... I can't think of a reason that the PB 6.5 upgrade would cause the SQL Anywhere db engi...

Help to return of PB 8 to PB 6.5.1.
Hi I want to know if exist a tool or a process or something to return to an older version of PB 8 like PB 6.5.1, PB 8 have some problems and I need solutions quickly and they aren't available, so I need go back to PB 6.5.1 while PB 8 is more secure. Thanks in advance Go to your backup made when you moved to PB8. Or better, what are the problems that you are having as someone may be able to resolve them for you. /ck "Efren" <> wrote in message > Hi I want to know if exist a tool or a proc...

migrating from pb 5.0 -> pb 6.0/6.5 any pothole
I am looking for any know potholes to avoid in migrating several PB 5.0 application to PB 6.0/6.5 using an Oracle 7.3 data base on Win 95 client? Thanks Brian, Take a look at Also, do your own search on 'mirgrating' and you should come up with a few other references. Frank Brian Scanlon wrote in message <01be37fa$0aa527a0$>... >I am looking for any know potholes to avoid in migrating several PB 5.0 >application to PB 6.0/6.5 >using an Oracle 7.3 data base on Win ...

PB 7 vs PB 6 & PB 5
We have a large application, compiled with PB 5.04, running at about 20 client sites. Generally speaking, if a PB 5.04 app is compiled with PB 7, what changes can the developer expect in app performance and memory usage? Thank you, st I'm assuming that 5.04 app is a 16 bit app. With PB7, you're going to be compiling 32bit apps. There are issues associated with that (I don't know if you are calling 16 bit functions or not). The files will generally be much larger. I haven't seen much myself that noticable as far as memory or performance issues though. O...

Web resources about - Help using OLE from a PB executable (PB 6.5) - sybase.powerbuilder.general

Executable - Wikipedia, the free encyclopedia
... . However, in a more general sense, a file containing instructions (such as bytecode ) for a software interpreter may also be considered executable ...

The Care and Feeding of Weird Machines Found in Executable Metadata [29c3] - YouTube
The Care and Feeding of Weird Machines Found in Executable Metadata The Executable and Linkable Format (ELF) is omnipresent; related OS and library ...

Agile Test Case Management – Specifications and Executable Specifications
... from the first three posts in this series and we’re well into realm of dangerous with Specification and their automated compatriots, Executable ...

Should You Recompile Your Software as a 64-Bit Executable?
Describes the 64-bit features available in OS X. As a general rule, in OS X v10.7 and later, the answer is probably yes. A 64-bit executable ...

For a year, gang operating rogue Tor node infected Windows executables
... Tor exit node. F-Secure Three weeks ago, a security researcher uncovered a Tor exit node that added malware to uncompressed Windows executables ...

Easily create icons from images or executables
... There is an easy solution to this problem, though, and it’s called Quick Any2Ico . Point this compact free program at an image or executable ...

Analysis Nirvana Via Stripped Executables and Binaries?
CodeSonar for binaries identifies security vulnerabilities in third-party executables

AMD’s GPU performance under Linux can be boosted by renaming certain executables
A new report claims that CS:Go players with AMD Radeon GPUs on Linux can boost performance significantly by renaming files.

Patent US5432937 - Method and apparatus for architecture independent executable files - Google Patents ...
The present invention is a method that enables single release of applications for multiple architectures and operating systems and to provide ...

pefile - pefile is a Python module to read and work with PE (Portable Executable) files - Google Project ...
pefile is a multi-platform Python module to read and work with Portable Executable (aka PE) files . Most of the information in the PE Header ...

Resources last updated: 12/29/2015 2:32:50 AM