Word 2010 - Trying to open Check Accessiblity and Properties panel from a macro - vba

I tried recording opening the "Check Accessibility" option under the File>info>prepare for sharing, but nothing gets recorded. I have tried going through all of the Dialog show commands, but cannot find any that will open the menu.
I also tried to turn on the "Show Document Panel", and I can't get that to toggle either.
How can I have these open with the macro? I want to setup the workspace with a single button.

Try
Application.DisplayDocumentInformationPanel = True

Try this.
Application.CommandBars("Accessibility Checker").Visible = true

Related

Attaching VBA Form to Outlook Application

I'm creating a custom form for appointments in Outlook for a project (add catering request to a meeting) - this is my first rodeo at doing this - and I'm striking out big time regardless of my intense (and failing) Google-Fu.
With a new appointment open, on the developer tab, I select "Design This Form". I go to tab "(P.2)" and build a stupid-simple, two-object form... CheckBox1 and TextBox1. In properties, TextBox1.Visible is False. Click View Code and input the following...
Private Sub CheckBox1_Click()
if CheckBox1.value=True Then
Me.TextBox1.Visible = True
Else Me.TextBox1.Visible = False
End If
End sub
I then click "Run This Form" and see/click CheckBox1 but nothing happens. If I could make this run, I might be in business. But it won't. So, I look for a work-around.
Grasping at straws, I open "Visual Basic" and basically do the same thing - create a form "UserForm1" with the same two objects and add the same code. Click the go-button and it works as expected. The TextBox1 appears and disappears with the CheckBox1 state.
As I can make the code function, I would build everything I need in the Visual Basic editor, however... Here's the problem - I have absolutely no idea how to get the form I create here into the Outlook application as a tab or button or whatever. I basically want the custom form VBA editor to be a selectable option in any Appointment.
I have watched tutorials, read doc, saw something about creating a macro - but nothing was written/stated dumbed-down enough for me to follow.
So my question: How do I get the UserForm1 that's built in VBA Editor to appear in a New Appointment when a button is clicked in Outlook?
You need to add the Click event handler for the CheckBox control, not just paste the code to your custom form.
Following the June 13 2017 security update, users discovered published custom forms no longer worked because VBScript behind the form and some controls are blocked by default. See Custom Form Security Changes and Custom form script is now disabled by default for more information.
Microsoft disabled custom form script functionality. If you need it enabled, you'll need to set two keys, one to enable scripting and a second one with the message class name of each form that has code behind it. For example:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security
DWORD: DisableCustomFormItemScript
Value: 0 (to enable)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList
REG_SZ: IPM.Contact.custom-form-name
Value: (leave blank)
In some cases, forms in secondary mailboxes and Public folders still don't work after the registry key settings. To fix this, enable scripts in the Trust Center:
Click File > Options. Then select Trust Center > Trust Center Settings > Email Security.
Under the Script in Folders section, click the checkbox for Allow script in shared folders and Allow script in Public folders and click OK and OK again to close out the windows.

Open a webpage in the default browser with specific size in VB.NET

I want my users to be able to click a button to open my company webpage in the default browser with specific size(Like-width=SomeSize,height=SomeSize')when clicked. How would I do this?
I'm using VB.net so all .net examples are acceptable.
To do this in whatever browser the user has installed would be very difficult. Each browser has its own command line arguments, so you would have to detect which browser is being used, and code for all possible browsers..
If you are willing to have windows open the page in Internet explorer, you could use add a reference in your solution explorer to the windows Shell Document Viewer.
To do this, in your solution explorer window, right-click on "References".
Click "Add Reference". This opens the "Reference Manager" window
In the window that opens, down at the bottom right click the button "Browse"
In the file dialog, in the file name box type "C:\Windows\System32\shdocvw.dll" without quotes.
Click the "Add" button. and the dialog should close, leaving you with the "Reference Manager" window.
In this window, in the list in the middle, you should see "shdocvw.dll" with a tick next to it. Click the "Ok" button.
You now have a reference to the Shell Document Viewer
Finally, add the following code to wherever you want the window to open and change the parameters to whatever you require
Dim TheBrowser = New SHDocVw.InternetExplorerMedium With {
.Visible = True,
.Width = 500,
.Height = 500
}
TheBrowser.Navigate(URL:="http://www.google.com")
You can just write:
System.Diagnostics.Process.Start("http://google.com")

Send keys in VBA on appearance of dialog box

Back in this question, I was looking for a way of disabling a particularly troublesome dialog from Outlook that warned me the attachments I was sending might be unsafe. Having concluded that the only security-setting options were unavailable because of administrator privileges, I've instead been trying to look for a workaround to have a script active within Outlook that does something like the following (pseudo VBA):
sub PollForDialog()
if dialogbox = open and dialogbox.name = "This outgoing message may..." then
Sendkeys arrowleft + enter
I've tried exhaustively to search for how to have scripts execute upon a messagebox popping up, and I haven't had any luck. Plenty of stuff about dialog boxes opening when a script is run, but nothing I can find on how to trigger on a dialog opening. Anyone able to help?
Thanks muchly.

VBA Macro to auto browse and open a file

I am writing a VBA macro to fill a web form with values from spreadsheet.
I have completed macro to fill all form fields except one to click on a button in form to Browse for files.
Below is the macro line to click the browse button.
IE.Document.getElementById("notification_picture").Click
I'm clueless on how to do the next steps i.e. to browse to a particular folder, select and open the file.
Any help is appreciated.
Man... particularly deal with IE is a pain...
You could use
Sendkeys "%S"
It will save it in Downloads folder and then you can move it, open or do whatever you want.
Many will say it is not good to use it because if the user change the focus while the macro is running it will not working, but it is the simplest way.

VBA to generate a default file name when Save As is selected in Word 2016

I have VBA that, in Word 2010, will default a file name into the Save As screen when the user selects the Save As file option. Word 2016 (Office 365) has a different interface with a screen to select a save location (OneDrive, This PC,etc) prior to the "standard" Save As dialog box appearing which seems to have broken the code to generate a specified default file name.
The code (with title simplified) is
Sub FileSaveAs()
With Dialogs(wdDialogFileSaveAs)
.Name = "MyTitle"
.Show
End With
End Sub
If I run the code in Developer to Debug, it works fine, with the Save As screen appearing and the file name defaulting but it does not work in the live environment where the file name defaults to the previous document name.
Based on web research, I have tried additional code to change the properties of the document place the name in the title as this is supposed to then default when Save As is selected but that also doesn't work.
Any suggestions or recommendations on how to resolve this would be appreciated.
Thanks!
Update 1/11/16:
Have been able to get a little closer by using the following:
Application.DocumentBeforeSave Event
example here https://msdn.microsoft.com/en-us/library/office/ff838299.aspx
tied to Using Events with Application Object
example here https://msdn.microsoft.com/en-us/library/office/ff821218.aspx
Had to add
Cancel=True
to the end of the event procedure code or the Save as Dialog box will open twice.
Still a bit clunky and seems to be limited to run only before the first user generated save event but almost workable.
Wanted to share what I found in case it helps others but any other suggestions for improvement would be appreciated as it still doesn't seem like the best solution.
Thanks again!
Thanks for reporting this. I have a potential workaround that I hope will help.
Could you use the SendKeys method (https://msdn.microsoft.com/en-us/library/office/gg278655.aspx) to send the keyboard shortcut (F12 for the Save As dialog, full list: http://aka.ms/Tf6yv0) to the application e.g.
App.SendKeys("{F12}")
when you need the Save As dialog to be displayed?
I hope this helps. Thanks again for bringing this issue to our attention, we will be looking further into the root cause.