forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL writing to Excel
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Jan 20, 2011 12:39 pm    Post subject: Reply with quote

I expect the use_url@ is saying "Open this file with the default process for a .csv file".
The same result would occur if you typed the name in a dos box or double clicked the name in windows explorer.
If, in explorer, you change the default process to open a .csv file, say from excel to notepad, then you would get a different result with the use_url@ call.
You can set up the default response for other file name extensions, including for .f95 to be ftn95.exe, rather than plato.

John
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Jan 20, 2011 1:15 pm    Post subject: Reply with quote

Absolutely spot on John.
And if you specify a file with a .txt extension, then Notpad will open it, .doc for Word and .pdf for acrobat. This is an easy way of providing a help file, simply use Word, print to a pdf and then use_url@ with the pdf name.
It probably opens your default web browser for a .htm or .html etc.

I quite often write a .csv files and then "use_url@" an Excel file with a macro that executes on opening, to load the csv and process the data to new Excel files.

Regards
Ian
Back to top
View user's profile Send private message Send e-mail
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Thu Jan 20, 2011 3:30 pm    Post subject: Hi Ian Reply with quote

The code you supplied if run precisely as you wrote it gives the following:

Runtime error from program:c:\documents and settings\ctroth1\my documents\fortran program\eva\test3.exe
Run-time Error
*** Error 29, Call to missing routine : _USE_URL# at 0x004010e3.


main - in file test3.f95 at line 7 [+00e8] [recur= 1]
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jan 20, 2011 4:50 pm    Post subject: Reply with quote

You need the interface to the subprogram, which is in Clearwin.ins (or the corresponding module). Other posters have assumed, perhaps, that you would use the line:

Code:
      INCLUDE <WINDOWS.INS>


(or CLEARWIN.INS on its own; WINDOWS.INS incorporates CLEARWIN.INS) to make sure that you have all the interfaces and definitions included.

My personal test is to look for any subprogram that ends in @, which makes it a "Silverfrost special". If there is one of those in the code, there is a good chance you need one or other of the INCLUDE files, and WINDOWS.INS is the one that hits most spots. There are several such "Incantations" that conjure up the real Silverfrost magic ...

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Jan 20, 2011 4:51 pm    Post subject: Reply with quote

You got me again! - insert as the top line:

Code:

      include <windows.ins>


Regards
Ian
Back to top
View user's profile Send private message Send e-mail
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Jan 20, 2011 4:53 pm    Post subject: Reply with quote

Thanks Eddie,
You beat me by a minute!
Ian
Back to top
View user's profile Send private message Send e-mail
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Thu Jan 20, 2011 6:23 pm    Post subject: Ok then Reply with quote

so I need to do this:

include (windows.ins)
character*256 csvfile
csvfile='mycsv.csv'
open(unit=10,file=csvfile,status='unknown')
write(10,1000)
1000 format('"Hello there",1.0,2.5,3.1415926')
close(unit=10)
call use_url@(csvfile)
end

I do of course need to have my version of mycsv.csv in the directory I take it!!!

If this is correct I ran that it compiled and ran and just brought the dos screen and sat there!
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jan 20, 2011 10:46 pm    Post subject: Reply with quote

I didn't know about use_url@, but I have used START_PPROCESS@ with some success. This works (for Excel in Office 2007, Office 2003 is in the folder .... Office11 ....):

Code:
      include <windows.ins>
      character*256 csvfile
      csvfile='mycsv.csv'
      open(unit=10,file=csvfile,status='unknown')
      write(10,1000)
1000  format('"Hello there",1.0,2.5,3.1415926')
      close(unit=10)
C      call use_url@(csvfile)
       IA = START_PPROCESS@('C:\Program Files\Microsoft Office\'//
     &                      'Office12\Excel.EXE',csvfile)
      end



Eddie
Back to top
View user's profile Send private message
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Fri Jan 21, 2011 12:46 pm    Post subject: Apologies Reply with quote

Apologies Ian your prog does work it does write to the CSV its just that the black screen did not tell me !!! I should realise it wont unless you give some end message...thanks anyway.

But really this is doing no more than opening a file and writing to it in the normal Fortran fashion as I have been doing as I originally wrote is it not...

No what I want to do is write to an Excel worksheet which I did partly manage using SQL but it did seem limited at least using the prog examples supplied via F90SQL webpage EXCELWRITE, EXCELUPDATE examples the first kept moving on down the page and writing fresh data, the other update one seems restricted to only a few records...could not modifiy either to work....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group