To make the window prompt word

1 / 1 / 0

Регистрация: 18.09.2018

Сообщений: 132

1

Word

Создать диалоговое окно

04.11.2018, 17:18. Показов 1402. Ответов 2


Студворк — интернет-сервис помощи студентам

Создать диалоговое окно в word vba.
На английском языке: To make the window prompt.



0



11482 / 3773 / 677

Регистрация: 13.02.2009

Сообщений: 11,145

04.11.2018, 17:57

2

Создать диалоговое окно в word

Смотри готовые решения внизу страницы!
Лень забить в поисковик — так воспользуйся готовыми результатами сайта



0



Spok-

1 / 1 / 0

Регистрация: 18.09.2018

Сообщений: 132

04.11.2018, 19:02

 [ТС]

3

Вот может это подойдет.

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Sub AutoExec()
 
'
 
' Макрос4 Макрос
 
' Макрос создан 23.10.2008
 
' Сообщение должно содержать имя, задаваемое по вводу. В случае не введения имени вывести другое произвольное сообщение приветствия.
 
Dim name As String
 
name = InputBox("Введите ваше имя", "Приветствие")
 
If name <> "" Then
 
msgbox "Привет, " & name, vbInformation, "Приветствие"
 
Else
 
msgbox "Добрый день,незнакомец!" & name, vbOKOnly, "cообщение"
 
End If
 
End Sub



0



The simplest way for a single item of data is as follows.

First, insert a FILLIN field in the template

(In Windows Word, use ctrl-F9 to insert a pair of the special field code braces { }
then type

FILLIN "my prompt text" 

between the { }

so you see

{ FILLIN "my prompt text" }

If you select the field and press F9, you should see a dialog box where you can type the value you need. When you have entered the value, Word should display the value at the location where the FILLIN field is (press Alt-F9 to toggle between «field codes» and «field results» view.

To make Word show the same thing in several places in your document, Select your FILLIN field and press ctrl-F9 again to wrap it in another pair of { } Then, after the initial «{«, type

SET myfield 

So that the whole thing looks like

{ SET myfield { FILLIN "my prompt text" } }

Then, at each point where you need the value, insert another field like this:

{ myfield }

which is shorthand for

{ REF myfield }

When you create a new document based on the template, Word should execute the FILLIN, then update all the { myfield } fields. But if the user needs to change the value later, they will need to select the entire document (e.g.ctrl-A) and press F9 to see the prompt again. In that case, I’m not sure the fields will be updated everywhere.

There is another field type called ASK which, in effect, combines a SET and a FILLIN, but it is not automatically executed when you create a new document based on the template so is not such a good choice for this task.

There is a bit more to the FILLIN field than that, but I leave you to look that up.

I make some apps using Dart and I have one simple question. I haven’t found the prompt dialog in dart:html library. I’ve found only alert and confirm dialog calls, but that’s not, what I need. I’ve tried some other possibilities from Dart api, but no way to do it. I think there should be something like a modal dialog or Dart own prompt dialog. I know, modal is here, but it only loads another file in the popup.

Can somebody help me?


Update: Actually, I found one solution. It’s an emulation of JavaScript in dart:js library:

var password=context.callMethod('prompt',['Password','']);

It is good solution, but I think, that there must be something better than emulating JavaScript.


Update 2: Because of an insufficiency of the prompt dialog in the Dart spec, Dart APIs and Dart libraries here is a bug on Google Code issue tracker, so let’s star the bug, if you think prompt is important in the spec or comment if you have any other idea, how to do it in a modern way (you can try to propose something like built-in modal dialog for example). Or just share it if you think prompt/modal dialog implementation should be also in modern programming languages…


Update 3: Now we are discussing the new modal alert, confirm and prompt dialogs, which could be in Polymer.dart library. Here is the enhancement on Google Code issue tracker, so let’s star the bug, if you are for the modern modal form of that dialogs, or discuss, if you know how to do it better…

Download PC Repair Tool to quickly find & fix Windows errors automatically

Microsoft Word has several useful command-line switches that can be used to start Word. These switches can be used to make Word run in a specific way or perform specific tasks – like if you want to start it in the Safe Mode without any addons.

To open a Word document using the switches in Windows 10/8/7, type winword.exe /x. Here “/x” is the switch.

To modify how Microsoft Office Word starts on a one-time basis, you can add switches to the Microsoft Windows Run command (Start menu).

The following is the list of switches for Microsoft Word:

Switch and parameter Description
/safe Starts Word in Safe Mode.
/q Starts Word without displaying the Word splash screen.
/ttemplatename Starts Word with a new document based on a template other than the Normal template.

Example    To start Word with a document based on a template called Myfax.dotx, stored on the C drive, type the following at the command prompt:

/tc:Myfax.dotx

Note: Do not include a space between the switch and the name of the template file.

Security Note: Because templates can store macro viruses, be careful about opening them or creating files based on new templates. Take the following precautions: run up-to-date antivirus software on your computer, set your macro security level to high, clear the Trust all installed add-ins and templates check box, use digital signatures, and maintain a list of trusted sources.

/t filename Starts Word and opens an existing file.

Example    To start Word and open the template file Myfax.dotx, stored on the C drive, type the following at the command prompt:

/t c:Myfax.dotx

Example    To start Word and open multiple files, such as MyFile.docx and MyFile2.docx, each stored on the C drive, type the following at the command prompt:

/t c:MyFile.docx c:MyFile2.docx

/f filename Starts Word with a new document based on an existing file.

Example    To start Word and create a new document based on file MyFile.docx, stored on the desktop, type the following at the command prompt:

/f “c:Documents and SettingsAll UsersDesktopMyFile.docx”

/h http://filename Starts Word and opens a read-only copy of a document that is stored on a Microsoft Windows SharePoint Services site. The site must be on a computer that is running Word 2007 or later or Windows SharePoint Services 2.0 or later.

Example    To start Word and open a copy of file MyFile.docx, stored in a document library at the URL http://MySite/Documents, type the following at the command prompt:

/h http://MySite/Documents/MyFile.docx

Note: If the document is checked out to you, the /h switch has no effect. Word opens the file so that you can edit it.

/pxslt Starts Word and opens an existing XML document based on the specified Extensible Stylesheet Language Transformation (XSLT).

Example    To start Word and apply the XSLT MyTransform, stored on the C drive, to the XML file Data.xml, also stored on the C drive, type the following at the command prompt:

/pc:MyTransform.xsl c:Data.xml

/a Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the setting files.
/ladd-in Starts Word and then loads a specific Word add-in.

Example    To start Word and then load the add-in Sales.dll, stored on the C drive, type the following at the command prompt:

/lc:Sales.dll

Note: Do not include a space between the switch and the add-in name.

Security Note: Use caution when running executable files or code in macros or applications. Executable files or code can be used to carry out actions that might compromise the security of your computer and data.

/m Starts Word without running any AutoExec macros.
/mmacroname Starts Word and then runs a specific macro. The /m switch also prevents Word from running any AutoExec macros.

Example    To start Word and then run the macro Salelead, type the following at the command prompt:

/mSalelead

Note: Do not include a space between the switch and the macro name.

Because macros can contain viruses, be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; set your macro security level to high; clear the Trust all installed add-ins and templates check box; use digital signatures; maintain a list of trusted publishers.

/n Starts a new instance of Word with no document open. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of other instances.
/w Starts a new instance of Word with a blank document. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of the other instances.
/r Re-registers Word in the Windows registry. This switch starts Word, runs Office Setup, updates the Windows registry, and then closes.
/x Starts Word from the operating system shell so that Word responds to only one Dynamic Data Exchange (DDE) request (for example, to print a document programmatically).
/ztemplatename

Visibly behaves exactly like the /t switch. However, you can use the /z switch with Word to generate both a Startup and a New event, whereas the /t switch generates only a Startup event.

If you plan to use a modified startup method frequently, you can create a shortcut on the Windows desktop, using these switches.

You can get the command line switches for Word, Excel, PowerPoint, Outlook and Access here at KB210565.

Ezoic

Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.

word logo

Like most apps, you can launch Word from the Command Prompt, but Word also supports several optional switches for controlling the startup process.

Whether you type the command at the prompt, use it to create a shortcut, insert it as part of a batch script, launching Word with additional parameters lets you do things like start Word in Safe Mode for troubleshooting or start with a specific template.

Before we can open Word using the Command Prompt, we need to figure out which directory the winword.exe file is located. You can do this manually, or you can just have the Command Prompt find it for you. To do this, go ahead and open the Command Prompt by opening the start menu and typing “cmd” and selecting the “Command Prompt” application.

Open Command Prompt in Start Menu

When you open the Command Prompt, you’ll be in the top tier directory—your user account folder. We need to dig deeper by going into the Program Files directory. Do so by entering the following command and then pressing Enter:

cd”program files (x86)”

Program Files in Command Prompt

You’ll now be in the Program Files directory. The next step is to locate the directory where the winword.exe file is located. Do so by typing the following command and pressing “Enter.”

dir winword.exe /s

Once you enter this command, the Command Prompt will locate the directory for you.

Winword directory

Now that you know the directory where the winword.exe file is located, you can use the cd command to open the file path. In this example, you would need to enter the following command:

cd Microsoft OfficerootOffice16

Now you should be in the directory where winword.exe is located.

Open Winword file

Now, if you want to open Microsoft Word the same way as if you were opening it via its icon, all you must do is type winword and then press “Enter,” and Word will open its usual way.

Open Normal Word

However, the whole point of using the command is that you can use the different switches and parameters it offers.

Common Word Command Line Switches and Parameters

Borrowed from the official Microsoft Office support site, here is a list of some possible ways to open Word, along with its respective command.

Switch and Parameter Description
/safe Starts Word in Safe Mode. This launches Word without any additional add-ins, templates, and other customizations. It’s helpful when troubleshooting problems in Word.

You can also launch Word in Safe Mode by holding down the Ctrl key while launching Word from the Start menu, creating a shortcut with this parameter makes it that much easier.

/q Starts Word without displaying the Word Splash screen.
/ttemplatename Starts Word with a new document based on a template other than the Normal template.

Example: Assume we wanted to open a document stored on the C drive called example.docx, we’d type the following command:

/tc:example.docx

Note: Do not put a space between the switch and the name of the file.

/t filename Starts Word and opens an existing file.

Example: To start Word and open the existing file example.docx, stored on the C drive, enter the following:

/t c:example.docx

To open multiple files, example.docx and example2.docx, located in the C drive at once, enter the following:

/t c:example.docx c:example2.docx

/f filename Starts Word with a new document based on an existing file.

Example: To start Word and create a new document based on file example.docx, stored on the desktop, enter the following:

/f “c:Documents and SettingsAll UsersDesktopexample.docx

/h http://filename Starts Word and opens a read-only copy of a document that is stored on a Microsoft Windows SharePoint Services site. The site must be on a computer that is running Word 2007 or later or Windows SharePoint Services 2.0 or later.

Example: To start Word and open a copy of a file example.docx, stored in a document library at the URL http://MySite/Documents, enter the following:

/h http://MySite/Documents/example.docx

Note: If the document is checked out to you, the /h switch has no effect. Word opens the files so that you can edit it.

/pxslt Starts Word and opens an existing XML document based on the specified XSLT.

Example: To start and apply the XSLT MyTransform, stored on the C drive, enter the following:

/pc:MyTransform.xsl c:Data.sml

/a Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the settings files.
/ladd-in Starts Word and then loads a specific Word add-in.

Example: To start Word and load the add-in Sales.dll, stored on the C drive, enter the following:

/ic:Sales.dll

Note: Do not include a space between the switch and the add-in name.

/m Starts Word without running any AutoExec macros.
/mmacroname Starts Word and the runs a specific macro. The m/ switch also prevents word from running any AutoExec macros.

Example: To start Word and then run the macro Salelead, enter the following:

/mSalelead

Note: Do not include a space between the switch and the macro name.

/n Starts a new instance of Word with no document open. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of other instances.
/w Starts a new instance of Word with a blank document. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of other instances.
/r Re-register Word in the Windows registry. This switch starts Word, runs Office Setup, updates the Windows registry, and the closes.
/x Starts Word from the operating system shell so that Word responds to only one DDE request (for example, to print a document programmatically).
/ztemplatename Visibly behaves exactly like the /t switch. However, you can use the /z switch with Word to generate both a Startup and a New event, whereas the /t switch generates only a Startup event.

That’s all there is to it! Now you should be able to open Word in any specific way you choose by simply following these commands.

RELATED: How to Run Command Prompt Commands from a Windows Shortcut

READ NEXT

  • › How to Turn Off Track Changes in Word
  • › How to Put Borders Around Images in Microsoft Word
  • › How to Make Columns in Microsoft Word
  • › How (and Why) to Start Microsoft Excel from the Command Prompt
  • › How to Link or Embed a PowerPoint Slide in a Word Document
  • › How to Troubleshoot Word Startup Problems
  • › How to Turn Off Dark Mode in Microsoft Word
  • › Microsoft Outlook Is Adding a Splash of Personalization

How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read billions of times. Want to know more?

Понравилась статья? Поделить с друзьями:
  • To make sure another word
  • To make something known word
  • To make someone happy word
  • To make someone at his word
  • To make right again word