473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Write statment and Shell statement

ARC
Hello all,

2 questions:

1) I'm trying to write my own html file using the following statement, where
"pastetext" is set with the proper html code.

filena = outputfolder & Trim$(rs!IncidentNumber) & ".html"
Open filena For Output As #1 'create DbLoc.txt
Write #1, pastetext
Close #1

It writes the file to the correct location, but the Problem is, it wraps the
variable pastetext in " " marks, thus making it an un-usable html file. How
do you get rid of the wrapped " marks? when it writes? Or, should I be
using a different method to write a text file?

2) After writing the file, I'm using a shell command, but I'm getting an
error 5: invalid procedure call. Is this a windows vista problem, or has the
syntax changed for acc 2007?

Dim retval As Variant, filena As String
filena = Me!SavedHTMLLoc & Trim$(Forms!fkBase.Form!IncidentNumber) & ".html"
retval = Shell(filena, 1)
Thanks!

Andy

Mar 12 '08 #1
6 1899
Hi Andy,

Replace Write with Print. Print does not add " " double quotes.

As for shell, I don't use Vista (right now) but I believe if you give
the location of the html file, it should open it the same as a text file

Retval = Shell("C:\yourDir\yourfile.htm",1)

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 12 '08 #2
ARC
Thanks, I'll try the print statement.

However, my shell statement and yours is the same:

retval = Shell(filena, 1)

filena = path/file name

Many thanks again,
"Rich P" <rp*****@aol.comwrote in message
news:12************@news.newsfeeds.com...
Hi Andy,

Replace Write with Print. Print does not add " " double quotes.

As for shell, I don't use Vista (right now) but I believe if you give
the location of the html file, it should open it the same as a text file

Retval = Shell("C:\yourDir\yourfile.htm",1)

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 12 '08 #3
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. That should do it.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 12 '08 #4
ARC
I'm using code, unfortunately.

Basically, I have a proc that's generating html code, and after it generates
and I save, I want to launch the file.

By the way, changing from Write to Print worked like a charm, thanks!

Now I just need to solve the error 5, invalid procedure call when
shelling...

Andy
"Rich P" <rp*****@aol.comwrote in message
news:12**********@news.newsfeeds.com...
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. That should do it.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Mar 12 '08 #5
On Mar 12, 5:54*pm, "ARC" <PCES...@PCESoft.invalidwrote:
I'm using code, unfortunately.

Basically, I have a proc that's generating html code, and after it generates
and I save, I want to launch the file.

By the way, changing from Write to Print worked like a charm, thanks!

Now I just need to solve the error 5, invalid procedure call when
shelling...

Andy"Rich P" <rpng...@aol.comwrote in message

news:12**********@news.newsfeeds.com...
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. *That should do it.
Rich
*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted text -

- Show quoted text -
use this instead:

Shell("Explorer C:\Path\Filename.html",1).

if that doesn't work, try to Google ShellExecute. it is not included
in VBA but you can add the library. there are many articles that have
the module you need to add to include ShellExecute.

Mar 14 '08 #6
ARC
Hi Guillermo!

You are the champ!!! The code you supplied worked like a charm! Thanks so
much,

Andy
"Guillermo_Lopez" <g.*****@iesdr.comwrote in message
news:57**********************************@x30g2000 hsd.googlegroups.com...
On Mar 12, 5:54 pm, "ARC" <PCES...@PCESoft.invalidwrote:
I'm using code, unfortunately.

Basically, I have a proc that's generating html code, and after it
generates
and I save, I want to launch the file.

By the way, changing from Write to Print worked like a charm, thanks!

Now I just need to solve the error 5, invalid procedure call when
shelling...

Andy"Rich P" <rpng...@aol.comwrote in message

news:12**********@news.newsfeeds.com...
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. That should do it.
Rich
*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted
text -

- Show quoted text -
use this instead:

Shell("Explorer C:\Path\Filename.html",1).

if that doesn't work, try to Google ShellExecute. it is not included
in VBA but you can add the library. there are many articles that have
the module you need to add to include ShellExecute.

Mar 14 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: ChrisC | last post by:
how would I put a '\n' in say outfile.write( record, sizeof(record)). Thank you in advance for your help. -- ChrisC - chrispche@nospam.yahoo.co.uk
1
by: Joe Saliba | last post by:
Hi, would like to know how to write a crosstable select statment in sql server2000 where having: - ItemNumber, ItemDescription, ItemColor, ItemSize as rows - Stores as columns - Qty * Netttc...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
8
by: 73blazer | last post by:
Hello, I'm looking for a way to make some of my insert templates more readable by placing comments in between the values. I cannot seem to find a way to do this with DB2, is there a way? I'm...
1
by: Me, Myself, and I | last post by:
First off, i apologize if my terminology is off... I am currently in a project that is basically a front-end to a database. In coding this, I am taking into account that it has the *potential*...
3
by: TD | last post by:
I have an unbound form that adds and updates records to one table. I use an INSERT sql statment to add a new record and a UPDATE statement to update a record. I created a function named C2F to...
9
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
4
by: huzzaa | last post by:
I am using a switch statement that will decide from a random number what message to display. I want the random number to be between 0 and 100 and then if the number is say between 1 and 10 to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.