Results 1 to 2 of 2

Thread: [RESOLVED] put a variable in selection

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Resolved [RESOLVED] put a variable in selection

    Hello people I wrote a code
    that navigates into the pageheader in microsoft word,
    the script removes 6 characters then add another number,
    I wrote in this code "123123"
    I have used
    Selection.TypeText Text:=""

    how do I put a variable instead of type a number
    example
    myVar=666666

    it adds the myVar value(666666) instead of 123123


    PHP Code:
     If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
            ActiveWindow
    .Panes(2).Close
        End 
    If
        If 
    ActiveWindow.ActivePane.View.Type wdNormalView Or ActiveWindow_
            ActivePane
    .View.Type wdOutlineView Then
            ActiveWindow
    .ActivePane.View.Type wdPrintView
        End 
    If
        
    ActiveWindow.ActivePane.View.SeekView wdSeekCurrentPageHeader
        Selection
    .MoveRight Unit:=wdCharacterCount:=3
        Selection
    .MoveDown Unit:=wdLineCount:=1
        Selection
    .MoveRight Unit:=wdCharacterCount:=2
        Selection
    .MoveLeft Unit:=wdCharacterCount:=2
        Application
    .Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Application.Run MacroName:= _
            
    "TemplateProject.tw4winProtection.tw4winKeyBackSpace"
        
    Selection.TypeText Text:="123123" 'here is the example number I want to replace with a variable 
        ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 

    Thank you in advance
    Last edited by elmnas; Aug 13th, 2014 at 02:44 AM.

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: [RESOLVED] put a variable in selection

    I assume it would be:
    Code:
    selection.typeText text:=myVar

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width