Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-09-2019, 05:57 AM
SamDsouza SamDsouza is offline ConmandButton dissappears when Content dispalyed on Page 1 Windows 10 ConmandButton dissappears when Content dispalyed on Page 1 Office 2013
Advanced Beginner
ConmandButton dissappears when Content dispalyed on Page 1
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default ConmandButton dissappears when Content dispalyed on Page 1

Hi

I just created an ActiveX command button on Page 1 of document to initilize userform


How can this be retained. ? because when clicking the command button of userform the document code overwrites and doest not display the command button as the content overwrites on page 1
any ideas if the document content is seen on Page 2. because on Page 1 i would just like the command button to retain

coding in thisDocument for CommandButton on Page1 of document
Code:
Private Sub cmdInitilizeuf_Click()
     Load userform1
    userform1.Show vbModeless
End Sub
in userform1 Coding
Code:
Private Sub cmdButton1_Click()
Dim objWord As Word.Application
Dim txtword As String
Dim objDoc As Document
Dim objRange As Range
Dim objTable As Table
Dim intRows As Integer
Dim intCols As Integer

    txtWord = "fsdhfkhfkdhfdskfhd fkdshfdkfhdskfhdsfd fdshgfdjdsjfg" & vbCr
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    Set objDoc = objWord.Documents.Add
    objDoc.Range.Text = txtWord
    Set objRange = objDoc.Range    
    objRange.Collapse Direction:=wdCollapseEnd
    intRows = 8: intCols = 5
    Set objTable = objDoc.Tables.Add(objRange, intRows, intCols)
    objTable.Borders.Enable = True
End Sub
Thanks SamD
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
using styles to generate content page TYPO Word 2 12-20-2015 12:48 PM
ConmandButton dissappears when Content dispalyed on Page 1 Insert the page before table of content without altering it kbhalakiya Word 2 08-29-2012 03:53 AM
ConmandButton dissappears when Content dispalyed on Page 1 Rotate Page and Content Within It. walker140 Word 1 11-13-2011 11:08 PM
ConmandButton dissappears when Content dispalyed on Page 1 Page number in table of Content Ritu Office 1 09-19-2011 05:10 AM
ConmandButton dissappears when Content dispalyed on Page 1 Paragraph Disappears when Tabbing it over GWalkaa Word 11 07-22-2011 03:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:32 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft