PDA

View Full Version : is Selection.Text a string? / Formatting execScript??



itsallgood
01-25-2013, 06:18 AM
Hi guys,

I'm having a problem with the following line:




Call ie.Document.parentWindow.execScript("tinyMCE.activeEditor.setContent('" & myVar & "');", "JavaScript")


if id do this: myVar = "hello all!" -- it works fine.

if i try this:

Selection.WholeStory
Selection.Copy
myVar = Selection.Text

I get an error - So all i can think is that Selection.Text is not a string, or it is wrapped in brackets.

Can anyone please help?

Thanks for reading! :bow:

:beerchug:

Frosty
01-25-2013, 12:39 PM
why don't you try declaring myVar as an actual string and see what happens. I'm guessing you don't have Option Explicit at the top of your module.

Dim myVar As String

Also.... how big is the document you are selecting?

Incientally: Selection.Copy is meaningless in this context, unless you also need to do something with the text in the clipboard-- Selection.WholeStory and Selection.Text are the only relevant lines of code