Click here to Skip to main content
15,895,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do I get back "handle of" created control via CreateWindowEx ? Pin
vmars31621-Nov-09 10:17
vmars31621-Nov-09 10:17 
AnswerRe: How do I get back "handle of" created control via CreateWindowEx ? Pin
Alan N21-Nov-09 10:56
Alan N21-Nov-09 10:56 
AnswerRe: How do I get back "handle of" created control via CreateWindowEx ? Pin
Luc Pattyn21-Nov-09 23:38
sitebuilderLuc Pattyn21-Nov-09 23:38 
QuestionHow can I produce a software license number from PDA's device ID? Pin
JUNEYT21-Nov-09 4:41
JUNEYT21-Nov-09 4:41 
AnswerRe: How can I produce a software license number from PDA's device ID? Pin
DaveAuld21-Nov-09 5:44
professionalDaveAuld21-Nov-09 5:44 
GeneralRe: How can I produce a software license number from PDA's device ID? Pin
JUNEYT21-Nov-09 6:10
JUNEYT21-Nov-09 6:10 
GeneralRe: How can I produce a software license number from PDA's device ID? Pin
DaveAuld21-Nov-09 20:08
professionalDaveAuld21-Nov-09 20:08 
QuestionInsert and fill a table with high-performance [Word] Pin
cherrymotion21-Nov-09 0:00
cherrymotion21-Nov-09 0:00 
Hello,

my aim is to insert a table with 100 rows and 2 cols at the end of a document.
Next I have to fill every row with a random font-name in the first column and a formatted text with that random font in the second column.
A font-type must not be repeated within the next 10 rows.

So here is a code, that does exactly that thing, but I want to find a more performant solution - maybe someone could help me how to optimize it. I know that there are much better ways how to solve this problem, thats why I ask.

Thanks in advance for taking the time,

cherry

'Set Range to end of document
            Dim where As Range
            Set where = ActiveDocument.Range(ActiveDocument.Range.End - 1, ActiveDocument.Range.End - 1)
            
            'Insert table with 100 rows and 2 cols
            Set tablewith_different_styles = ActiveDocument.Tables.Add(where, 100, 2, _
                DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed)
            
            
            'Loop 100 times for each Font
            i = 0
            g = 1
            Do While i < 5
                Do While g < 21

                    'Got to table row i, col 1
                    tablewith_different_styles.Cell((i * 20) + g, 1).Select
                
                    
                    'Set random font
                    Selection.Font.Name = FontNames(g + 20)
                    'Save random font
                    Name_Font = Selection.Font.Name
                    'reset font for next output
                    Selection.Font.Name = "Courier New"
                    Selection.Font.Size = 9
                    'Insert font name and iterate to next line
                    Selection.TypeText Text:=Name_Font
                    Selection.MoveRight Unit:=wdCell
                    
                    'set font and size
                    Selection.Font.Name = FontNames(g)
                    Selection.Font.Size = 9
                    Selection.TypeText Text:="My Formatted Text in every Row."
                
                    g = g + 1
                Loop
                g = 1
                i = i + 1
            Loop

AnswerRe: Insert and fill a table with high-performance [Word] Pin
Johan Hakkesteegt21-Nov-09 1:42
Johan Hakkesteegt21-Nov-09 1:42 
GeneralRe: Insert and fill a table with high-performance [Word] Pin
cherrymotion22-Nov-09 7:24
cherrymotion22-Nov-09 7:24 
GeneralRe: Insert and fill a table with high-performance [Word] Pin
Johan Hakkesteegt22-Nov-09 20:14
Johan Hakkesteegt22-Nov-09 20:14 
GeneralRe: Insert and fill a table with high-performance [Word] Pin
cherrymotion23-Nov-09 9:19
cherrymotion23-Nov-09 9:19 
GeneralRe: Insert and fill a table with high-performance [Word] Pin
Johan Hakkesteegt23-Nov-09 23:08
Johan Hakkesteegt23-Nov-09 23:08 
QuestionHow to read and write image informations Pin
Maik Lange20-Nov-09 19:17
Maik Lange20-Nov-09 19:17 
AnswerRe: How to read and write image informations Pin
Johan Hakkesteegt21-Nov-09 1:36
Johan Hakkesteegt21-Nov-09 1:36 
GeneralRe: How to read and write image informations Pin
Maik Lange21-Nov-09 22:19
Maik Lange21-Nov-09 22:19 
GeneralRe: How to read and write image informations Pin
Johan Hakkesteegt22-Nov-09 1:48
Johan Hakkesteegt22-Nov-09 1:48 
GeneralRe: How to read and write image informations Pin
Maik Lange22-Nov-09 21:09
Maik Lange22-Nov-09 21:09 
GeneralRe: How to read and write image informations Pin
Johan Hakkesteegt23-Nov-09 0:26
Johan Hakkesteegt23-Nov-09 0:26 
GeneralRe: How to read and write image informations Pin
Maik Lange23-Nov-09 2:51
Maik Lange23-Nov-09 2:51 
Questiontrouble in passing parameter in crystal document Pin
aguest20-Nov-09 12:05
aguest20-Nov-09 12:05 
AnswerRe: trouble in passing parameter in crystal document Pin
tosch22-Nov-09 19:46
tosch22-Nov-09 19:46 
GeneralRe: trouble in passing parameter in crystal document Pin
aguest22-Nov-09 21:21
aguest22-Nov-09 21:21 
GeneralRe: trouble in passing parameter in crystal document Pin
tosch22-Nov-09 21:36
tosch22-Nov-09 21:36 
GeneralRe: trouble in passing parameter in crystal document Pin
aguest23-Nov-09 1:23
aguest23-Nov-09 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.