|
-
Dec 1st, 2003, 07:26 PM
#1
Thread Starter
Fanatic Member
the 'immeadiate' window :nvm. RESOLVED
Does anyone know how to get the text out of the immediate window and into a word doc.
would it be soemthing like:
debug.text (as the data in the immediate)
Also - if i use this method, will it still work in the compiled version?
THanks guys xx
Last edited by evexa; Dec 2nd, 2003 at 08:57 PM.
Trust no one
----------------------------------------
http://www.eccentrix.com/members/xeaudrey/exanegotium.html
http://www.eccentrix.com/members/xeaudrey/
-
Dec 1st, 2003, 07:28 PM
#2
Debug.Print places the text in the Immediate Window but these statements are not included in compiled applications. There is no Immediate Window at run-time.
-
Dec 1st, 2003, 07:59 PM
#3
Thread Starter
Fanatic Member
Blimey!
So how on earth do i get the text i put in there to go somewhere else?

this is the code Im using, it indents a paragraph of text:
any idea what I can do instead?
THanks dood xx
VB Code:
Option Explicit
Private objWord As Object 'instead of Word.Application
Private wd As Object 'instead of Word.Document
Private Declare Function SendMessageByVal Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_FMTLINES = &HC8
Function SplitLinesIntoArr(Ctrl As TextBox) As String()
Dim sTmp() As String, i As Long
SendMessageByVal Ctrl.hwnd, EM_FMTLINES, True, 0
sTmp() = Split(Ctrl.Text, vbCrLf)
For i = 0 To UBound(sTmp)
If Right$(sTmp(i), 1) = vbCr Then
sTmp(i) = Left(sTmp(i), Len(sTmp(i)) - 1)
End If
Next
SendMessageByVal Ctrl.hwnd, EM_FMTLINES, False, 0
SplitLinesIntoArr = sTmp()
End Function
Private Sub Command1_Click()
Dim sLinesInTextbox() As String
Dim i As Integer
sLinesInTextbox = SplitLinesIntoArr(Text1)
For i = 0 To UBound(sLinesInTextbox)
Debug.Print vbTab & sLinesInTextbox(i)
Next i
End Sub
Trust no one
----------------------------------------
http://www.eccentrix.com/members/xeaudrey/exanegotium.html
http://www.eccentrix.com/members/xeaudrey/
-
Dec 1st, 2003, 08:14 PM
#4
Instead of outputting to the Debug (Immediate Window) build a String Buffer, and output that out to a .doc File (youv'e done that before).
VB Code:
For i = 0 To UBound(sLinesInTextbox)
strBuff = strBuff & vbTab & sLinesInTextbox(i) & vbCrLf
Next i
You can output the Buffer (to Word) in your BookMrks/New Doc etc 
Bruce.
Last edited by Bruce Fox; Dec 1st, 2003 at 08:17 PM.
-
Dec 1st, 2003, 08:19 PM
#5
Thread Starter
Fanatic Member
Wow, I swear I learn more on here than in any book/online course.
You guys need to write a book 
thanks again xx
Trust no one
----------------------------------------
http://www.eccentrix.com/members/xeaudrey/exanegotium.html
http://www.eccentrix.com/members/xeaudrey/
-
Dec 1st, 2003, 08:20 PM
#6
Blimey, eh!
Why don't you just move the textbox data into Word directly as a Paragraph and then indent the Paragraph. Remember, if it can be done within the Word application, it can be done in VB using the Word automation server.
[edit]
I did not see Mr. Fox's post before I sent this reply. His method will work as well.
-
Dec 1st, 2003, 08:21 PM
#7
Thread Starter
Fanatic Member
Originally posted by brucevde
Blimey, eh!
Why don't you just move the textbox data into Word directly as a Paragraph and then indent the Paragraph. Remember, if it can be done within the Word application, it can be done in VB using the Word automation server.
Is there somewhere where I can fins these word things. Like indenting a paragraph - that would be very helpful ?
Trust no one
----------------------------------------
http://www.eccentrix.com/members/xeaudrey/exanegotium.html
http://www.eccentrix.com/members/xeaudrey/
-
Dec 1st, 2003, 08:29 PM
#8
If you have a reference to the Word Object Library in your VB project, then hit F2 to bring up the object browser. In the top combobox select Word. This will allow you to see all the objects, collections, methods etc. of the Word Automation server (and there are a lot). Using these you can do anything to a document that you can do in Word.
Also, to bring up more help, select an object in the left pane and hit the Help button (question mark) at the top. Providing everything is installed properly this should bring up the help file for Word (or maybe its Office).
-
Dec 1st, 2003, 08:33 PM
#9
VB6 has the Join Function, it will concertrate a String Array.
You can use it instead of the For i Next.
This is an example:
That will join back the Array, seperated by ","
So, in your case, you could try:
VB Code:
strBuff = vbTab & Join([b]sLinesInTextbox[/b], vbCrLf + vbTab)
May be worth a try (replaces your For Next)
Note: The use of the vbTab prior to the Join!
Bruce.
Bruce.
-
Dec 1st, 2003, 08:35 PM
#10
Opps, I missed a bit of the convo while I was typing/testing 
Bruce hasd a point.
Bruce.
-
Dec 2nd, 2003, 05:22 PM
#11
Thread Starter
Fanatic Member
Something wierd happened to the text i indented...
I typed in this:
This is the quote that i want to test for repeating sentences......whyaifhskiufoeuifroewiuroweiuoweiuroiuwer
and it indented it but repeated sentances and ended up like this:
This is the quote that i want to test for repeating
This is the quote that i want to test for repeating
sentences......whyaifhskiufoeuifroewiuroweiuoweiuroi
This is the quote that i want to test for repeating
sentences......whyaifhskiufoeuifroewiuroweiuoweiuroi
uwer
Instead of just indenting what i had.
Note: This must be done within the program not as it gets tranferred to word...
Will using 'join' get rid of that problem?
THanks guys in advance xxxxx
Trust no one
----------------------------------------
http://www.eccentrix.com/members/xeaudrey/exanegotium.html
http://www.eccentrix.com/members/xeaudrey/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|