Write statment and Shell statement 
March 12th, 2008, 07:25 PM
| | | Write statment and Shell statement
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 | 
March 12th, 2008, 08:05 PM
| | | 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 *** | 
March 12th, 2008, 09:35 PM
| | | 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 ***
| | 
March 12th, 2008, 09:55 PM
| | | 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 *** | 
March 12th, 2008, 09:55 PM
| | | 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 ***
| | 
March 14th, 2008, 04:15 PM
| | | 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: |
*** 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. | 
March 14th, 2008, 05:15 PM
| | | 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:
*** 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. | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,662 network members.
|