Print function error

F

Finius Eetch

I've been using the Print function quite successfully to generate HTML
reports from my project schedule. However, I've just ran into a problem I
don't know how to solve. I have some JavaScript menu code I wrote that I
want to export to the same location as my html report files. Instead of
distributing .JS files with the project schedule, I was simply going to
create the file when the project schedule report feature was ran. I figured
the best way to do this would be to simply 'Print' the same way I was writing
the HTML, but the JS code. Some lines work fine, others give 'ERRORS' cannot
compile when i'm simply typing the text to print out in the line (see below)

Print #HTMLFile, "window.onerror=new Function("return True")"

This line highlights (return) as a cannot compile. Shouldn't it just ignore
everything between the quotes as plain text? That's what I want it to do.
Some of the lines are actually getting modified by the editor as well.

I'm sure there is an option buried somewhere, but there is alot of stuff to
dig through and i"m obviously looking in the wrong place.

Thnx,
Finius
 
R

Rod Gill

Hi,

The problem is in the double quotes. Try using

Print #HTMLFile, "window.onerror=new Function(""return True"")"

or even

Print #HTMLFile, "window.onerror=new Function("""return True""")"


--

Rod Gill
Project MVP

NEW!! Project VBA Book, for details visit: http://www.projectvbabook.com
 
F

Finius Eetch

Rod,
I should have actually caught that, I was so consumed with the menu
code I couldn't register that the string would end when it saw the 2nd quote
without doubles.

Guess you need questions like that to keep you on your toes :)
Egg on face,
Finius
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top