hyperlink,ms-word,ms-office,copy-paste,word-2010
I Found a Workaround! Select a whole hyperlink, press shift + F2 (Copy text), place cursor on the place where you want to paste link and press ENTER (don't use paste function). And you have the same address in hyperlink :)...
Could you make a view on your database accessing the three tables as necessary; then in word do your mail merge against the view?
vba,ms-word,word-vba,office-2013
Yes, in my opinion, you are making a mistake. I have just recently finished a project where I have created a document template for a company. My experiences: Users vary in knowledge level (obviously) High level users don't like over-engineered files, because they can't use their own macros as they...
The for ... next loop is done from the end (ThisDocument.InlineShapes.Count) to the start of the array to be sure to go through all items that need to be deleted. For instance, going from first to last item, if your array has 3 items: Object(1) Object(2) Object(3) By deleting the...
I have found my questions answer: IMPORTANT: The total size of a master document and its subdocuments cannot exceed 32 megabytes (MB). In Microsoft Windows, the maximum number of subdocuments that are allowed in a master document depends on the number of files that you have open, the size of...
use a third party component: Aspose.Words, it can do it for you. Document doc = new Document(MyDir + "Document.doc"); doc.Save(MyDir + "Document.ConvertToHtml Out.html", SaveFormat.Html); it also support save to Png format. SaveFormat.Png: Renders a page of the document and saves it as a PNG file. ...
As per our conversation in the comments, change Dim Rng1 As Range to Dim Rng1 As Object. You can find the actual values of XlDirection, Xlvalues, xlwhole enums. Preferably, it's better to do it like this: Private Const xlUp as long = -4162 'and so on Edit1: Here's an adjusted...
You should be able to set the rPr property on a plain text content control to include: http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/caps.html Failing that, its not elegant, but you could always include a second element in your XML with the caps form....
On the contrary, Microsoft's advice is very much not to use it: Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when...
c#,selenium-webdriver,ms-word,office-interop
I have modified the code with below.I am passing range object which solving my problem as of now.Still looking for better solution if there any. object o_CollapseEnd = WordC.WdCollapseDirection.wdCollapseEnd; WordC.Range imgrng = aDoc.Content; imgrng.Collapse(ref o_CollapseEnd); imgrng.InlineShapes.AddPicture(imgFilename, Type.Missing, Type.Missing,imgrng); ...
I have found the answer thanks to @Tim Williams pointing me in the right direction. It was because of the hidden text flag being set to true, I do not know how it got set to true as I can not find any reason for it to be. Anyway if...
function test() { var wordApp = new ActiveXObject("Word.Application") var doc = wordApp.Documents.Add() var col doc.Tables.Add(Range=doc.Range(0, 0), numrows=1, numcolumns=2) doc.Tables(1).Borders.Enable = true row = 1 col = 0 while (!rs.eof) { col = col + 1 alert(row) if (col = 1) { doc.Tables(1).Cell(row,1).Range.Text = rs.Fields("firstname").value col = col + 1 rs.movenext...
Ah, now your question is more clear based upon your last comment. I found this method - give it a try: http://word.mvps.org/FAQs/TblsFldsFms/HLinksInForms.htm If this works let me know, I don't have time to test it out but seems promising....
Assuming you're using VSTO, you can read the Globals.ThisAddIn.Application.Version property (see MSDN Blog article). string version = Globals.ThisAddIn.Application.Version; string majorStr = version.Split('.').First(); int major = Convert.ToInt32(majorStr); if (major == 14) // Word 2010 // ... else if (major == 15) // Word 2013 // ... ...
vba,hyperlink,ms-word,word-vba
Since you have the hyperlinks already created. It should just require looping through the documents hyperlinks collection and changing the 'TextToDisplay' property. This should get you started: Public Sub ChangeHyperlinksText() Dim hlink As Hyperlink For Each hlink In ThisDocument.Hyperlinks hlink.TextToDisplay = "Link" Next hlink End Sub ...
Never mind, I was able to get it to work after a bit more tweaking. Here's the final code for anyone else: Do While .Execute Selection.MoveDown Unit:=wdLine, count:=1 Selection.Paragraphs.Indent For Each fieldName In mergeFields If fieldName <> "" Then Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, PreserveFormatting:=False Selection.TypeText Text:=mergeFields(I) Selection.MoveRight Unit:=wdCharacter, count:=2 Selection.TypeParagraph I...
Do you mean : Dim myNumber If Not IsNumeric(myValue) Then myNumber = InputBox("Enter number:") MsgBox "Entered " & myNumber End If Please note that negative numbers are also Numeric....
I isolated the problem and it seem to happen only when there's special characters in the word document, particularity if text is contained inside a custom table. on normal plain documents it works fine. I ended up sampling the range.Start value after each search, if it was the same as...
textbox,ms-word,word-vba,word-2013
First find out what is the name of that textbox. For that you can use this code Sub Sample() Dim shp Dim R1 As Word.Range Set R1 = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range For Each shp In R1.ShapeRange Debug.Print shp.Name Next shp End Sub Once you know the name then simply use that name...
Unless they are leaving anything in your Word document, something like "Was done via vba" or anything like that. Then creating a new Word Document with just the text copied and pasted will not copy over the macros. You could use the macros to do this as well. Just have...
Create an empty directory "Desktop" in C:\Windows\SysWOW64\config\systemprofile\ this solved the issue. I guess this is problem with user rights for the desktop folder under users directory. The user by which tomcat service is running....
You may have to use repurpose commands. Here is the how to In Ribbon.xml <commands> <command idMso="Paste" onAction="CustomPaste"/> </commands> In Ribbon.cs public void CustomPaste(Office.IRibbonControl control, bool cancelDefault) { //Globals.ThisAddin.Application.Selection.Paste(); //Check if the pasted content is image and then add caption to it } ...
excel,vba,excel-vba,ms-word,word-vba
I believe there are two issues here. First, graphics in word have an anchor. When the graphic is pasted, the anchor for it is placed in the table created by Excel's cells. This throws off positioning. Second, I suggest using the Shape.RelativeHorizontalPosition property, which will allow your Shape.Left property to...
Your question is not very clear. This would likely help you anyway. If you have a String a, which you want to pad with blanks up to 255 characters, you would do Dim apad As String apad = a & space(255 - len(a)) ' or 'apad = a & String(255...
Instead of attaching the DocumentBeforeClose event handler on application startup, consider attaching it on document open—and only if it's not an embedded object. The tricky part is determining whether the document being opened is an embedded object. I haven't found any documented way to explicitly check whether an Automation application...
Try to use the capture.output() function. Like this: Results <- capture.output(summary(your.lmer.model)) It stores the summary information in the new variable. After that you can use it in e.g. ReporteRs paragraph functions....
There are two ways to do this, either you declare the separate subroutines e.g. sub mySub(myVar as integer) then call the sub within your code with: mySub(b) The 2nd way is to declare the variables outside any subroutines like: public b as integer then you can simply use them in...
Something along these lines should at least get you started: Dim searches() As String Dim replaces() As String searches = Split("( , %", ",") replaces = Split("(,%", ",") Dim i As Integer For i = LBound(searches) To UBound(searches) With Selection.Find Do .ClearFormatting .Text = searches(i) .Replacement.Text = replaces(i) .Execute Replace:=wdReplaceAll...
The order of the bars is governed by the order of the source data. You can't just drag the bars around. Instead, edit the chart source data and make the desired changes. By default, the value at the top of the source data will be plotted closest to the X...
The short answer is "yes, you can do this with Akka.NET" As Hans points out in his comment: Word doesn't care much about your library. Its interop interface is single-threaded, any call you make from a worker thread is automatically marshaled to the thread that owns the Application object. You...
Based on your error, I would suggest that you read the text file one line at a time, looping through till the EOF (End Of File). This will give you a bit more flexibility. Here is how you need to modify your LoadTextFile method to get it right, Public Function...
Well, I did this. It's not exactly and auto-split process but it does the thing: Sub CutSelect() Dim ruta As String Selection.Cut ruta = ActiveDocument.Path Dim doc As Document x = x + 1 Set doc = Documents.Add Selection.Paste '-----You can add some other things to do here doc.SaveAs ruta...
When Word executes the OpenDataSource method, it concatenates the SQLStatement and SQLStatement1 parameter values to create a single query statement. To use a simplified example, if your query needs to be SELECT * FROM mytable Then you could for example set SQLStatement:="SELECT *", SQLStatement1:=" FROM mytable" i.e. you need to...
performance,vba,ms-word,word-vba
I consider this pretty much a no-brainer - do as large of a chunk as you can hold in memory at the same time. Most of the performance issues in Word come from resolving Ranges and Selections. Paragraphs, Sentences, and Words are even worse because Word has to pre-parse the...
Ok, I solved the problem with the following code, posting it for others who might drop by in the future. Private Sub CommandButton1_Click() Dim objTemplate As Template Dim objBB As BuildingBlock ' Set the template to store the building block Set objTemplate = ActiveDocument.AttachedTemplate ' Access the building block through...
Character classes ([]) match literally any of the contained characters. Because of that, [First|Second|Third|1|2|3] matches F, i, r, s, t, |, S, etc. You'll want to use alternation outside of the character class. You can group this using (...) or if you want a non-capturing group (?:...). Try replacing [First|Second|Third|1|2|3]...
Simple but hard to debug. Just add space between words in style. document.add_paragraph('Intense quote', style='IntenseQuote') Changes to: document.add_paragraph('Intense quote', style='Intense Quote') ...
A .docm document can be more or less be considered to be a normal .zip file. You can therefore open your document with some PHP unzipping function/library, thereby gaining access to the included file word/vbaProject.bin. You then need find or create a PHP library that can modify this vbaProject.bin file....
c#,visual-studio,crystal-reports,ms-word,converter
I have done this in the past by creating a text box on the report canvas. Copy and paste the contents of your Word Doc into the text box. Maybe 1 text box per Word Doc page as I am not sure if there is a text limit in a...
How can anyone expect the code in the template to work if macros are disabled? Try ALT+F11 to get into the VBA environment and show the code. Put the cursor in the code you want to debug and press F8 to step into it or F5 to run it to...
python,perl,batch-file,ms-word
Thanks to 'Haf Linger', I managed to found the answer to my problem: #!perl use strict; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); ##CONFIG## my $new_status="Closed"; my $docx_name="TEST.docx"; my $tmp_name="tmp.docx"; my $replace_file=1; #set to 0 for testing purpose #### #Open docx file my $doc = Archive::Zip->new($docx_name); #Retrieve old status my $old_status=undef;...
vba,ms-word,automation,word-vba
here is something to get you started Word 2010 Edit this should allow you to open all txt files in one document and save it Option Explicit Sub AllFilesInFolder() Dim myFolder As String Dim myFile As String Dim wdDoc As Document Dim txtFiles As Document Application.ScreenUpdating = False myFolder =...
The problem seems to be in the scope of your declaration. By doing this: Private Sub UserForm_Initialize() (...) Dim trans As New clsTransaction '<-- declaration + assignment End Sub you are declaring trans in the scope of UserForm_Initialize(). Hence, when you then try to do something with it into another...
vba,ms-word,office-interop,word-vba
Try this: Sub ReplaceHighlightedTextColor() Dim rng As Range Set rng = Selection.Range With rng.Find .ClearFormatting .Highlight = True While .Execute(Forward:=True, Format:=True) 'Note: 'rng' is now the range containing the matched content rng.Text = rng.FormattedText.HighlightColorIndex Wend End With End Sub ...
Don't use file extension to indicate file type. Don't use a fixed number of chars to remove an extension - this will fail for old fashioned .doc (instead of .docm). Use InStrRev. This is designed for things like this. Strip the extension off, then save as your desired type using...
database,excel,ms-access,ms-word
Translate that form into Excel. Use "Collect Data" under the "External Data" tab on the ribbon to collect data from customers. To pull data onto your spreadsheet from Access do something like this. Use an Excel spreadsheet for the form. Then make a command button with the following event on...
vba,ms-word,ms-office,word-vba
EDIT SOLUTION FOUND For posterity ... This code finds all paragraphs with less than 100 characters (assumes a heading) and underlines them: Sub Underline_Header() Dim numOfParagraphs As Integer numOfParagraphs = ActiveDocument.BuiltInDocumentProperties("NUMBER OF PARAGRAPHS") Selection.HomeKey Unit:=wdStory For x1 = 1 To numOfParagraphs Selection.Paragraphs(1).Range.Select char_count = Len(Selection.Paragraphs(1).Range) If char_count < 100...
There are a few topic to be discussed here. The form To upload the file, change the form enctype attribute. <form action="insert.php" method="post" enctype="multipart/form-data"> : </form> Storing the file You could store the file in a database, or just as file in the server disk system. Whatever you choose, it...
What you should do is use a dictionary where each word is the key value. public Dictionary<string, int> AnalyzeString(string str) { Dictionary<string,int> contents = Dictionary<string,int>(); string[] words = str.Split(' '); foreach(string word in words) { if(contents.ContainsKey(word)) { contents[word]+=1; } else { contents.Add(word,1); } } return contents; } With this you...
Finally figured it out. I was using the style name and not the style id. So the line where the style is declared should look like: TableStyle tableStyle = new TableStyle { Val = "LightShading-Accent1" }; ...
If you already created the style, you can just assign it like this: oCC.DefaultTextStyle = "style_name" Now, if not, you'll have to add your style first. Something like: ActiveDocument.Styles.Add Name:="MyStyle1", Type:=wdStyleTypeCharacter With ActiveDocument.Styles("MyStyle1").Font .Name = "Arial" .Size = 12 .Bold = True .Color = RGB(255, 0, 0) 'you can use...
Strings are sorted by their characters so strings "10", "1" and "8" will be sorted differently then numbers 10,1 and 8. Just strip the array of the string "Issue:" and convert the values in the array before comparing them to Longs using the CLng function like this: CLng(arr(i)). Your code...
c#,vba,ms-word,office-interop,word-vba
The below statement would get you the color index of selected text in MS Word Dim objSelection As Selection Set objSelection = Application.Selection Msgbox objSelection.FormattedText.HighlightColorIndex The value returned is one of wdColorIndex enumeration. List of values in enumeration can be seen here https://msdn.microsoft.com/en-us/library/bb237561(v=office.12).aspx Update#1 Below code is using ActiveDocument.Range.Find as...
On Error GoTo [error-handler-label] tells VBA to jump to the specified label whenever a runtime error occurs in a method. When you use error handlers, you're telling VBA "it's all good, no need to blow everything up, I can handle it". So when Sub D runs: Sub D() On Error...
That is because your code is slightly incorrect. Also imagePath is a variable. When you put it within Quotes, it becomes a string. Since I don't have access to the picture link mentioned in your post, I am using a different link. Try this (In MS Word) Sub photobomb() Dim...
Create your Req Level 1 style Style based on (no style) Create Req Level 2 style Style based on Req Level 1 Click on Multilevel list Define a new list style Click on Format Numbering Click on the more button Link level to Req Level 1 Click on level 2...
I found solution! For me it works with the following code: Novacode.Paragraph p = docx.InsertParagraph(someText, false, someFormat); p.InsertPageBreakAfterSelf(); or just add empty paragraph: Novacode.Paragraph p = docx.InsertParagraph(string.Empty, false); p.InsertPageBreakAfterSelf(); Thus if we insert page without inserting section it will no break the format!...
You are on the right avenue. You need to use callbacks instead of attributes. But Office caches the values and don't call the callbacks each time as you want it. Instead, to refresh the UI (force Office application to invoke callbacks) you need to use the Invalidate or InvalidateControl methods...
2 issues: First, wrdRange is only set the first time through the loop, and can't change after that due to the If Count <> 1 test. Check all of the references to wrdRange for If Count <> 1. Second, when you are setting newRange = prevRange, you aren't getting a...
Found the answer from here: http://blogs.msdn.com/b/dmahugh/archive/2006/12/10/images-in-open-xml-documents.aspx Needed to add a param: TargetMode="External" ...
Yes, you can by using a OpenXML.WordProcessing.View. You need to create a View with its Val set to ViewValues.Web. Then you need to create a Settings object and append the view to it. Finally, you need to create a DocumentSettingsPart and set its Settings property to the settings object you've...
If you are using the Dir function, there is no need to change directory first. Try this Directory = "S:\PROJETS\GT R\test\" FType = "*.doc" FName = Dir(Directory & FType) Documents.Open FileName:=Directory & FName ...
I don't know why you can't combine it as you have, but ... Maybe I'm missing something, but when you are typing out the mergefield statement, where you currently have "Check!", just replace it with the symbol you want directly (i.e., put your cursor there, then on the 'insert' tab,...
I think you're problem is in the fact that you're iterating i inside your for loop which already iterates on i If Label2.TextBox3.value is 4 then your loop would only run 3 times because of your i = i + 1 line. I don't totally follow your logic but try...
I haven't had a chance to test this, but it should parse your "recipe" into multiple cells, starting at C3. I'm assuming that these are written as sentences, so I'm finding the last period within 1024 characters, and putting everything up to that in the first cell, then continuing from...
Assuming you're using the code above for adding both tables (possibly in a loop) I think the issue is that you're overwriting the first table with the second one since you use the same range. The documentation for Tables.Add says: The range where you want the table to appear. The...
You should be able to use the SetRange method as per below: Set prevRange = wrdDoc.Bookmarks(PrevBmarkName).Range Set newRange = prevRange 'Have to set the range to something initially newRange.SetRange prevRange.End, prevRange.End ActiveDocument.Bookmarks.Add "BmarkName", newRange ...
Programatic access to the VBA project will need to be enabled if it isn't already. However, to add the sub you described after the other code runs add this code to your sub: ThisDocument.VBProject.VBComponents("ThisDocument").CodeModule.AddFromString "Sub AutoClose(): ActiveDocument.Saved = False: End Sub" That should do the trick. You may have to...
Maybe the following code would be helpful to you? ThisWorkbook.ActiveSheet.Hyperlinks.Add Range("A1"), "http://stackoverflow.com" Just instead of the web address you would need the phone number....
c#,ms-word,powerpoint,office-interop,word-interop
You should use the Languages property to get the collection of languages. _Application.Languages Property Returns a Languages collection that represents the proofing languages listed in the Language dialog box. Here _Application represents the Microsoft Office Word application....
vba,ms-word,word-vba,word-2010
This page says you should shrink your Range so it excludes the end-of-cell marker. Dim newRange As Range With tblTitle.cell(2, 1) .Range.Text = rStatTitle.Cells(1, 1) Set newRange = .Range newRange.End = newRange.End -1 Do Until newRange.ComputeStatistics(wdStatisticLines) <= 1 ...
Something like this: Sub ReplaceTables() Dim oTable As Table Dim oRng As Range For Each oTable In ThisDocument.Tables If oTable.Rows.Count > 1 And oTable.Columns.Count > 1 Then If IsNumeric(oTable.Cell(2, 1).Range.Words(1).Text) And _ IsNumeric(oTable.Cell(2, 2).Range.Words(1).Text) Then Set oRng = oTable.Range oTable.Delete oRng.Text = "[TABLE]" & vbCrLf End If End If Next...
Okay here is start Option Explicit Sub AddFileIcon() SendKeys "%F{TAB 4} {TAB 5}" Dialogs(wdDialogInsertObject).Show End Sub Now you Create Button :-) and call the Macro Here is help full Links VBA SendKeys Word Dialog Boxes ...
A simpler way would be to have a variable of type Boolean. When the button is clicked change the value of the Boolean, and then use a conditional statement to re-enable saving
It maintains temporary information about the current state of the document. Have you ever encountered a crash and when you open Word it asks you to recover certain documents that were being edited? That's where it gets that information....
You should use FormFields.Result Sub ScreenB() Dim a As Double If ActiveDocument.FormFields("Dropdown9").Result = "No" Then a = 1 Else a = 2 End If MsgBox a End Sub ...
vba,templates,ms-word,word-vba
As mentioned, there are several ways to do this. I would suggest storing the images outside of the template, otherwise all documents based on the templates would include all logo images, even if they are not shown, making the documents bigger than they need to be. That approach makes installing...
c#,html,ms-word,office-interop
The macro recorder is your friend. Instead of InsertFile, use InlineShapes.AddOLEObject instead. See https://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.inlineshapes.addoleobject%28v=office.11%29.aspx. I just recorded embedding a Word object and this is what I got: Selection.InlineShapes.AddOLEObject ClassType:="Word.Document.12", _ FileName:=[pathToMyFile], LinkToFile:= _ False, DisplayAsIcon:=True, IconFileName:= _ "C:\PROGRA~2\MICROS~1\Office14\WINWORD.EXE", IconIndex:=1, IconLabel:= _ [myFileName] ...
regex,replace,ms-word,word-vba,pci
Since it seems like you are using the Word wildcard syntax, you probably can use <, which asserts beginning of word, and >, which asserts end of word to prevent the pattern from matching when the text is preceded or succeeded by letters or numbers (which is how it seems...
c#,vba,ms-word,word-vba,readonly
In order to turn off ReadingMode your need to put this at the beginning of your code Globals.ThisAddIn.Application.Options.AllowReadingMode = false; You may get errors because of the direction of your loop. Your first page is page 1 once you delete this then page 2 becomes page 1 etc If you...
It appears my foreach (and hence my cast) was not correct (per Eugene Astafiev's question in the comment above). I found this SO Post that suggesting looping with type Control instead of UserControl. I did this and all was good. Here is the code: foreach (Control lbxControl in myUserControl.Controls) {...
c#,c#-4.0,ms-word,aspose.words
You can get idea from this page in Aspose documentation. Below is the sample code taken from the same page, but only related to custom page numbers. String src = dataDir + "Page numbers.docx"; String dst = dataDir + "Page numbers_out.docx"; // Create a new document or load from disk...
c#,winforms,ms-word,word-interop
You can use the Find object of an empty (or indeed any) Range to set the bounds of the range to a particular word/string in the document: Word.Range range = document.Range(0, 0); if (range.Find.Execute("<table>")) { // range is now set to bounds of the word "<table>" } The Execute method...
We can do it in PowerShell. Break your requirement in two pieces FIRST - Convert PDF to WORD Document '**** The script runs in a loop until it detects a new file in the directory '**** It checks the source folder every 30 seconds. To change this interval '**** change...
com,ms-word,office-interop,asp.net-mvc-6
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment. If you are building a solution...
You should be able to get an existing instance of the application in vbscript code like so: Dim excelObj Set excelObj = GetObject(, "Excel.Application") You can then call any application methods on that object: excelObj.CommandBars("research").Enabled = False For Word, do the same as above but use "Word.Application". Note: GetObject will...
ms-access,ms-word,access-vba,ms-access-2010,word-vba
Here's a method that heavily references this. Before you start make sure you have these (or your Access version's equivalent) references ticked in VBA editor > Tools > References: Microsoft Word 15.0 Object Library Microsoft Office 15.0 Object Library Assuming you've set up a form with a command button to...
Eventually, I finished up with this, and it works (it's lame, it's ugly, but it does what it should): public string[] GetPagesDoc(object Path) { List<string> Pages = new List<string>(); // Get application object Microsoft.Office.Interop.Word.Application WordApplication = new Microsoft.Office.Interop.Word.Application(); // Get document object object Miss = System.Reflection.Missing.Value; object ReadOnly = false;...
Pupa Rebbe's solution of adding Application.ScreenUpdating = False before the "For" loop works, thanks! A cursor flashes a little bit as it is working, but it's nothing like the annoying strobe effect I was getting. ...
I've looked at OpenXML with Office. The tags are pretty easy to use, but I don't like the whole ZIP archive solution. This means styles go in one XML file, content in another, etc. Then you'll want to check out The Flat OPC Format, where the OPC parts are...
android,android-studio,ms-word,syntax-highlighting,export-to-word
As long as MS Word 2013 does not support syntax highlighting for code, you are not able to "automatically" colorize the copied code. Since the plain text does not contain color information's. It's only text. The highlighting comes from Studio itself, which parses the text and colorizes the text accordingly...
When setting the background color programmatically it's displayed only if you change the view type to Online Layout: objDoc.Background.Fill.Visible = True objDoc.Background.Fill.ForeColor.RGB = RGB(55, 255, 155) objDoc.Background.Fill.Solid objWord.ActiveWindow.View.Type = 6 It'll be visible only in that layout, though, so this might be a bug. On a more general note: please...