Microsoft Word

28K

Solutions

21K

Contributors

Microsoft Word is a commercial document editing program that is part of the Microsoft Office suite. It features numerous text-editing tools for creating richly formatted documents, along with tools for the use of macros in Word documents. Word's native file formats are denoted either by a .doc or .docx file extension. Plugins permitting the Windows versions of Word to read and write formats it does not natively support, such as the OpenDocument format (ODF) are available. Word can import and display images in common bitmap formats such as JPG and GIF. It can also be used to create and display simple line-art.

Share tech news, updates, or what's on your mind.

Sign up to Post

Word doesn't provide a way to use Search and Replace to replace a capitalized word with a non-capped word (or vice versa).  But would it be possible to somehow manipulate it?  Could it be done with a VBA macro?
0
Running Windows 10 and latest version of Office 365.  After I modify the footer of any Word document and I exit the footer, for some reason it automatically puts about 2 to 3 pages of extra returns at the tail end of the document.  I have to go back and delete them every time.  I'm not sure what is causing this.  As I was typing I was thinking it may be how I have entered and exited the footer section for many many years.  I do so by double clicking the footer to get in and double clicking the body to get out.  Any suggestions would be appreciated.
0
Using Word VBA (Word 365/2016), I create a new document from a template using code, then I simply want to set my focus to that newly created document (bring it to the top).  Regardless of how many other documents are open, and without knowing the entire document window caption (because sometimes it sticks "Reliability Mode" in the window title).  

I've spend hours searching, and tried AppActivate, setfocus, SetForegroundWindow, BringWindowToTop, a clever function called GetHandleFromPartialCaption, and a dozen other suggested methods but nothing seems to be working reliably for me.  

This can't be that difficult, and I know I have done it in the past but having real troubles this time.  Please help!
0
Could somebody tell me what's wrong with this code?  I swear this macro worked yesterday.  (And I just got it yesterday.)  There are no changes in the code.  I've checked it against the original.  That seems to mean thatThe error message maybe the code perceives a change in my system, which is not impossible.  I have a programmable keyboard which I change a lot.  However, it won't run with a regular keyboard either.  

Can you tell me what kind of things to look at?  What is this error message asking me to change?

Here's the code.  The attached picture shows the location of the error.

Sub JumpSelectRight()
'
' Macro for SELECTING WORD LEFT-RIGHT
'
'
On Error GoTo msg
   Char = Selection.Next(unit:=wdCharacter, Count:=1)
   
   If Char = " " Then
    Selection.MoveRight unit:=wdWord, Count:=1, Extend:=wdExtend
   Else
    Selection.MoveRight unit:=wdWord, Count:=1, Extend:=wdExtend
            If right$(Selection.Text, 1) = " " Then
            Selection.MoveRight unit:=wdCharacter, Count:=-1, Extend:=wdExtend
                 If right$(Selection.Text, 1) = " " Then
                 Selection.MoveRight unit:=wdCharacter, Count:=-1, Extend:=wdExtend
                 End If
           End If
    End If
Done:
Exit Sub
msg:
End Sub
0
In Word, is it possible to make a nonbreaking em dash?  Right now, I need to have an em followed by a quotation mark at the end of a line, and the quotation mark insists on being on the next line!  Like this--
"
0
Can a query result in ColdFusion be exported to a docx file? I see examples using cfspreadsheet to export to excel but not for word. Ideally I would open a word template and select a bookmark and export results to that location.

Anyone have an example?

I'm new to ColdFusion so trying to learn what I can do. Using ColdFusion 2016 with ColdFusion Builder.
0
I need to parse addresses into their individual parts (street, city, state, zip).  It's proving extremely difficult for me.  I've found a few suggestions online, but they're either too complicated to adapt to my situation, or the code just doesn't work.  I'm not a newbie to vba, but not an advanced expert either.

The addresses are located in an Excel column.  Each address is in only one cell.  There is only one delimiter...a comma between the city and state.  But some cities are one word, others are two.  It just seems impossible to do with normal string parsing.

Some examples (I used dummy street numbers, so as to keep confidentiality):
123 N PRESBYTERIAN AVE ATLANTIC CITY, NJ 084014702
123 POPLAR AVE APT A GALLOWAY, NJ 082054598
1 TEXAS CT ATLANTIC CITY, NJ 084016422
1 W LEE AVE ABSECON, NJ 082012608
PO BOX 123 ABSECON, NJ 082010688

Any help is greatly appreciated!
0
Can someone show me a real-life example of using the hyperlink base field (Advanced Properties) in MS Word, Excel, or PowerPoint.
I've read a few explanations but I think one or more step-by-step real-world examples would help.
0
How can I export a PDF file to a CSV file?
Do I need Adobe Acrobat Professional to export a PDF file to a CSV file?
Can I save the PDF file to Microsoft Word then export the Word file to a CSV file?

Office 365
Windows 10
0
In Word, is it possible to reselect the recently selected text?

Something I do frequently is copy from outside Word to inside Word.  When the text gets to Word, I need to format it as quoted text -- different from how it was outside Word and different from my Normal style or normal text inside Word.

As soon as I paste it, Word unselects it, and I have to reselect it exactly to apply my quoted text formatting.

Is it possible to ask Word to automatically reselect it?
0
I'm trying to create a Word macro that skips backwards one word at a time.  Ctrl-Left arrow will do that automatically, but it will stop at the beginning of each word.  I want to stop at the END of each word, and to the right of any punctuation mark.

Here's the code I have so far, which doesn't work.  Starting with my cursor at the end, it does go backwards, but it gets messed up when their are two spaces after a punctuation mark.  ETA:  I have edited this several times because I keep getting closer.  This one is very close!

Selection.MoveLeft Unit:=wdWord, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    If Selection.Text = " " Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        End If
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    If Selection.Text = " " Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        End If
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    If Selection.Text = " " Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        End If
    If Not Selection.Text = " " Then
        Selection.MoveRight Unit:=wdCharacter, Count:=1
        End If
End Sub
0
Word 2016/Win10:

In the attached (scrubbed) snipped from my novel, I changed the first line to black via the color palette in Word. (First color on the left in in the screenshot below.)
palette
 (I had temporarily changed it to another color.)  However, the second line (untouched) looks a bit different, color-wise. Can anyone tell me what color that is? Is it Word's default color?

Thanks.
Steve
what-color-is-this.docx
0
I need a bit of code for a Word macro that will capitalize the first letter of a word if it's not already capitalized.  But if it is already capitalized, then I don't want it changed.

My current macro uses Shift-F3, which is Word's toggle between cap/not cap.  It works great when the target word is lower case, but if the word is already capped, it lower cases it, which is not what I want.

So, here's the situation in which I would use it.  Say there's a run-on sentence like this:

Mary likes apples Tom likes oranges.

I want to put my cursor after the s in apples and run the macro.  The macro should type a period, move over one space, add a second space, select the T in Tom, and capitalize it if it's not capitalized and leave it alone if it is capitalized.  Then I want the cursor to end up just to the left of the T in Tom.  

And here's my current code:

Sub insertaperiod()
'
' insertaperiod Macro
'
'
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdWord, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Range.Case = wdNextCase
    Selection.MoveLeft Unit:=wdCharacter, Count:=2
    Selection.TypeText Text:="."
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.TypeText Text:=" "
End Sub

Thank you to this very helpful group!
0
Would anyone care to  help me with a Word macro that jumps to the end of the next word?

Ctrl-Right arrow will do this out of the box, BUT it goes to the BEGINNING of the next word.  I want to stop at the END of the next word.

So I wrote a fairly simple macro that uses Ctrl-Right to go to the beginning of the next word, and then a left arrow to go back one space.  And that works great unless there is punctuation involved or two spaces at the end of a sentence (which I use).  In that case, my macro leaves me in the middle of a word or in between the two spaces.

I know there is programming code for find the end of a word and find the beginning of a word or find the next character that's not a space.  But a problem that I'm having is that Ctrl-Right stops before a punctuation mark.  I need my macro to stop after the punctuation mark.  Ctrl-Right won't do that.  

Can anyone help?
0
Hi guys,

I have a client that needs to LOCK - Password Protect a Folder on Google Drive, local & online versions...

They have a couple computers & staff has access to their google drive folders online & local versions.  

They want to be able to have an ADMIN folder where they would put files that only can be accessed by the higher staff.  

Can this be accomplished??  I am not sure I am looking at this the right way, but the result of locking 1 folder is what I need, that would need a password to enter that folder, can this be done?

I know they can password protect let say a Word or Excel file as they go, but they want to be able to just drop a file in the protected folder & then it be Locked... can this be done??

Oh yea & it needs to be easy for client to be able to implement if they have additional folders later on... lol... Of course I can setup initial folder, but down the road they may want to add folders...

Please let me know... Thanks... :-)
0
In Word, is it possible to disable the Alt key accessing the menus?  I have a lot of alt-macros, and often, when I press Alt (the first key of the macro), the menu opens up before I can type the second key to invoke the macro.  Then I have to stop what I'm doing, press Escape multiple times, and begin again.

Can this be disabled?
0
I need to slow down a Word macro.  It's a very simple macro that skips forward word by word, stopping at the end of a word.  I'll include the code below.

I do transcription for a living.  I need to be able to cursor through the text at approximately the same pace as the speaker.  My normal cursor key moves far slower than my speaker.  My Next Word macro moves far faster than my speaker.  

I am not a programmer, but I do understand Word macros.  So please give me specific instructions.  :)

Thank you in advance.

Sub nextword()

'
' nextword Macro
'
'
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdWord, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
End Sub

Open in new window

0
I would like to move the cursor to the end of all the text in a TextBox ( named  
txtNote

Open in new window

) clicking a button on the form.
Both the TextBox and the CommandButton are on a user Form.
I am using the following code but when I click the button I find the cursor at the start of all the text and not at the end of the text.

Private Sub cmdMoveCursor_Click()
txtNote.SetFocus
txtNote.SelStart = txtNote.SelLength
End Sub

Open in new window


Thank you for your help
0
I would like to delete the last character typed in a text box using VBA. So if my text box contains some text like  -  this is an apple  - and the cursor is to the right of the last letter (e) of the apple, when I run my VBA code it should delete the letter e and the sentence would then become - this is an appl -
Thank you for your help.
0
Friend has an HP 1310 PSC. At one time he was having printer issues so we installed it again and in his printer and devices there is a 1310 and a 1310 (copy 1). He kept saying he could only print from Word and not from an email, etc. After a closer look some of the print jobs are being sent to the default and some are not. Why not?
I assume this can be resolved by deleting copy 1 but he is reluctant to do that.
0
This question is in a way related to a previous question I asked on this forum which is here.
https://www.experts-exchange.com/questions/29148228/VBA-code-to-detect-which-key-the-user-has-pressed-in-a-text-box.html#a42878897

What I would like to be able to do is run some code, such as deleting all the Text in TextBox1 one when I press space key after typing some text in the TextBox1 and then displaying a message box saying "Hello" when the user presses the space key. The following does achieve this but after code has run it leaves the cursor in the TextBox1 some spaces
further away from the start point (depending on how many characters I had typed before pressing the space key). So if I press space key after typing abc in the TextBox and then press space key all text from TextBox1 gets cleared but the cursor is left four space away from the start point of the TextBox1. I would
like the cursor to be at the start of the TextBox1 when I press space key. So basically I am looking for a way of
moving the cursor to the starting point in the TextBox1 after my code has run.
Thank you for your help.

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

Select Case KeyAscii
 Case 32 'space
 TextBox1.Text = ""
MsgBox "Hello"
 ' the above line does clear the TextBox1 of all its text but it leaves the cursor in the TextBox1 some spaces
' further away from the start point. So if I press space key after typing abc in TextBox1 and then press space all 

Open in new window

0
I would like code against the KeyPress event of a TextBox in VBA application. I would like to detect which key has been pressed by the user when the user presses a key. I am wondering if there is way of doing that.
I would like in particular to know if the user has pressed the space key or a number key.
Thank you for your help.

Private Sub TextBoxI_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

'need to know which key the user has pressed and take a an action based on the key pressed for example display a message box when the user presses space key.

End Sub

Open in new window

0
Having a Word template in which a Excel file is incorporated.
I need to be able to open the excel file and read the content of the cells in column A for not empty
and copy it into an other excel file, in which I will have a VLookup to retrieve the description of code in Column A.

I can't figure it out.  I don't know how to open the excel file into Word and be able to read in it.

Can you help please.
Thanks
Nancy
0
I would like to get all entries stored in my Word Autocorrect file (a file with the extension .acl") into an Excel sheet or in some other format such as .csv file so I can read data from it.
I am wondering if there is way for achieving this. I know you can use VBA to add auto correct entries to this file but I would like to do the opposite that is read data from the auto correct file. If it is not possible to do that using VBA, is there any other application or means through which I can open this .acl file and read data from it.
Thank you for your help.
0
Hi,

I have a problem on Word and macros.

I use this macro :
Sub refresh()

    Selection.WholeStory
    Selection.Fields.Update
    ActiveWindow.View.ShowFieldCodes = True
    ActiveWindow.View.ShowFieldCodes = False
    
End Sub

Open in new window


I want to run this macro with this .vbs:

Dim Word

Dim WordDoc

Set oArgs = WScript.Arguments

Set Word = CreateObject("Word.Application")

Word.Visible = False
Set WordDoc = Word.Documents.Open(oArgs(0))

Word.Run "refresh"

WordDoc.SaveAs2(oArgs(2))

WordDoc.Close(wdDoNotSaveChanges)

Word.Quit

WScript.Quit

Open in new window


here the command I launch to execute this vbs :

cscript C:\refresh.vbs C:\Users\admin\Desktop\a.docx refresh C:\Users\admin\Desktop\b.docx

And nothing happen... here

C:\refresh.vbs(14, 1) Microsoft Word: command failed

Do you have a solution?

Thanks
0

Microsoft Word

28K

Solutions

21K

Contributors

Microsoft Word is a commercial document editing program that is part of the Microsoft Office suite. It features numerous text-editing tools for creating richly formatted documents, along with tools for the use of macros in Word documents. Word's native file formats are denoted either by a .doc or .docx file extension. Plugins permitting the Windows versions of Word to read and write formats it does not natively support, such as the OpenDocument format (ODF) are available. Word can import and display images in common bitmap formats such as JPG and GIF. It can also be used to create and display simple line-art.