Connecting Tech Pros Worldwide Forums | Help | Site Map

Write statment and Shell statement

ARC
Guest
 
Posts: n/a
#1: Mar 12 '08
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


Rich P
Guest
 
Posts: n/a
#2: Mar 12 '08

re: Write statment and Shell statement


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 ***
ARC
Guest
 
Posts: n/a
#3: Mar 12 '08

re: Write statment and Shell statement


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" <rpng123@aol.comwrote in message
news:1205351399_177@news.newsfeeds.com...
Quote:
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 ***
Rich P
Guest
 
Posts: n/a
#4: Mar 12 '08

re: Write statment and Shell statement


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 ***
ARC
Guest
 
Posts: n/a
#5: Mar 12 '08

re: Write statment and Shell statement


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" <rpng123@aol.comwrote in message
news:1205357878_2@news.newsfeeds.com...
Quote:
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 ***
Guillermo_Lopez
Guest
 
Posts: n/a
#6: Mar 14 '08

re: Write statment and Shell statement


On Mar 12, 5:54*pm, "ARC" <PCES...@PCESoft.invalidwrote:
Quote:
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:1205357878_2@news.newsfeeds.com...
>
>
>
Quote:
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. *That should do it.
>
Quote:
Rich
>
Quote:
*** 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.

ARC
Guest
 
Posts: n/a
#7: Mar 14 '08

re: Write statment and Shell statement


Hi Guillermo!

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

Andy
"Guillermo_Lopez" <g.lopez@iesdr.comwrote in message
news:57445774-61db-457a-acfb-2e437626a0f5@x30g2000hsd.googlegroups.com...
On Mar 12, 5:54 pm, "ARC" <PCES...@PCESoft.invalidwrote:
Quote:
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:1205357878_2@news.newsfeeds.com...
>
>
>
Quote:
try adding a hyperlink label (or whatever the hyperlink control is) to
your form. That should do it.
>
Quote:
Rich
>
Quote:
*** 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.

Closed Thread