Navigating word document with vbscript [duplicate] - ms-word

This question already has an answer here:
How to use excel built-in constant in VBS [duplicate]
(1 answer)
Closed 4 months ago.
I want to open a word document and jumpt to page 5 with a vbscript. In vba the following works:
Set word_app = CreateObject("Word.Application")
set word_doc = word_app.documents.open(doc_path)
word_app.displayalerts = false
word_app.visible = true
word_doc.activate
word_doc.select
word_app.activewindow.selection.Goto wdGoToPage, wdGoToAbsolute, 5
but in the vbscript i just jump to page 7 (last page of doc) instead.

Instead of using the GoToItem and GoToDirection constants names, just use their number values: learn.microsoft.com/en-us/office/vba/api/word.wdgotoitem

Related

vscode: How to get all opened files with vscode api? [duplicate]

This question already has an answer here:
How do I get all the tabs in a Visual Studio Code window as an array of filenames?
(1 answer)
Closed 8 months ago.
I wanna get all the opened files with vscode api.
for example, my editor opened 001.cpp and 002.cpp, i wanna get a array like this, [0] = "001.cpp", [1] = "002.cpp".
I tried to find such api on https://code.visualstudio.com/api/references/vscode-api#TextEditor. But i only find TextEditor, and it only returned the focused file.
vscode.window.activeTextEditor.document.fileName
But i wanna an array including all the opened filename.
Since of April 2022 (1.67) you can now use Tab API to achieve that.
So, in your case you need this:
import * as vscode from 'vscode'
// Get labels of opened files in all groups
vscode.window.tabGroups.all.flatMap(({ tabs }) => tabs.map(tab => tab.label))

Multi Selection Words? [duplicate]

This question already has answers here:
How to turn off "matching" highlighting in VS Code?
(5 answers)
Closed 1 year ago.
In VS Code, when I select a word, all equal words in the text are automatically selected. Is it possible to disable this feature? Unfortunately, I don't know what it's called.
I found it!
It's this setting:
"editor.occurrencesHighlight": false

How to change current folder in Matlab [duplicate]

This question already has answers here:
setting a default matlab path at startup
(2 answers)
How to set a folder as Current folder for every startup of Matlab?
(4 answers)
Closed 2 years ago.
I have tried these methods, but all of them didn't work:
1 pereference->general->initial working folder -> I change to my folder, but didn't work
2 setpath->add my folder on the top of folder,didn't work
3 userpath(myPath);
When I restart the icon in desktop, it always show this direction:
..\Polyspace\R2019b\bin
If both of them didn't work
open the Matlab icon's properties and change shortcut -> start in

Manually entering number instead of text field in swift [duplicate]

This question already has answers here:
Input from the keyboard in command line application
(20 answers)
Closed 4 years ago.
I want to print "Best Country" based on numbers in swift
for example : - if i enter " 1 " it will print "Best". if i enter " 2 " it
will print " Country ". For 1 and 2 it will print " Best Country ".
how to manually enter numbers in swift ?
As per the OP it seems a project with console input/output is desired. To input values from console. You need to create a console based project with swift selected as Language.
Xcode -> New -> Project...
then select appropriate option as in screenshot below :
Press Next and then fill in the required details (project Name etc...)

How to find all occurrences of a word or a character and edit in visual studio code? [duplicate]

This question already has answers here:
Select multiple lines with cursors at each line start
(5 answers)
Closed 4 years ago.
How to find all occurrences of word or a character and select them once and edit using multi cursor in visual studio code?
I have list of users and need to add domain before names.
I have:
abc
pqr
xyz
I want :
domain\abc
domain\pqr
domain\xyz
I want to search for a new line character which will take me to the end of the each user name then by pressing home button I should reach to the beginning of each user where I will type "domain\" and it will modify each user at once.
I was able to do this in sublime text 3 by find all feature which provides multi cursor at each occurrence of character.
Is there any way to do the same in VS code ?
The easiest way to achieve this doesn't involve searching for newlines but rather by
Making a selection (Such as Ctrl+A)
Add cursor to all lines of the selection (Alt+Shift+I)
Pressing home (Home)
You can use search and replace with a simple regular expression.
Search for: ^(.+)$
Replace with: domain\\$1
Make sure to enable regular expressions (Alt+R).