By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Write statment and Shell statement

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.