Access Report Size Uncontrollable! - vba

I have a report in Access 2007 that is opened by pressing a button on a form. This button triggers an OpenReport macro, where the report is told to open in Print Preview view, and Dialog window mode.
How can I manually set the size of this window, along with the opening zoom level?
In the properties of the report, both AutoResize and FitToPage have been set to No. However, I have tried other combinations and had no luck.
Any help is much appreciated.

You could always set the windows position and size in the OnOpen event. Use the SetWindowPos function to do this. You can find out how to use it here.
I don't think there is a way to set the zoom level.

This is a two part solution.
First, in order to resize your window you must set the Document Window Options to "Overlapping Windows" located under Access Options then CUrrent Database.
Now you will be able to resize your dialog window.
Once you are done, save the form and verify it's the size you want by opening it.
If you prefer to have a tabbed document rather than overlapping window you can switch back now and it will retain the correct dialog size.
It's a little convoluted but it works.

Related

Create a custom information window in Word VBA

Is it possible to somehow have way for the Selection.Style (and possibly other info) to always show up in a custom information window similar to the way Debug.Print prints in the immediate windows but ALWAYS visible?
I find myself struggling to quickly check a Selection.Style. MsgBox requires clicking "OK".
I have used the "Reveal Formatting" window but I would like more control over how the information displays.
Is this possible?
At least for knowing the Style at the current selection point, you don't need a custom user form. Place the StyleGalleryClassic control on the QAT or a Ribbon tab.

Can Not Delete Control in VS2010

At the top of the Properties Window in VS2010, I can see a list of all of the controls on my form. In that last, I see "PictureBox1," even though I don't see a corresponding PictureBox in the Form window.
I can change the location and size of the PictureBox, and set its image to a picture that should be noticeable. I still see nothing on the GUI form. If I can't find something to click on the GUI form, however, I don't know how to get rid of this superfluous PictureBox.
Is there some backdoor method that I can use to get rid of this PictureBox? It seems if the Properties Window lists it, it should offer some method to delete it.
A simple explanation is that it is covered by something else. Use View + (Other Windows) + Document Outline to see it. You can drag+drop it back on top. Or just right-click + Delete and its gone.

Excel Button Growing

I'm working on a workbook in Excel 2010 that someone else created (I don't know which version they were using) with a button in it that invokes a macro. There are a lot of macros defined, so I'm right-clicking on it to find out which one it calls, but the context menu doesn't appear. Instead, when I click off, the button gets larger. I can make this happen as many times in a row as I'd like. There is another button the same worksheet that has the same context menu problem, but instead of growing, the text shrinks each time. There is another button that functions normally when I do this.
Growing buttons in Excel is a fairly common issue, with several theories about why this happens, including the use of multiple monitors or using proportional fonts. I have yet to see a definitive answer about this, but there are several workarounds that may work for you.
Delete and re-create the buttons.
Programmatically set the height and width of the buttons when the workbook is opened and when a button is clicked.
Select the button with another object or two on the sheet and group them.
Don't use them at all.
My personal choice is #4. As an alternative to buttons, I either use hyperlinks or shapes with macros assigned to them.
I think you want to enter "Design Mode" in the work book:
You should be able to right-click on the button to see what it does after that.
I have this same issue. I have two Excel workbooks with similar buttons on each. This only happens on one of them, but it happens every time I open that file.
I have found a sort of work-around. I open a blank Excel document, then I open the affected one and the buttons do not change size any more. When I open the second one, I have to drag it into the window with the already-open file. If I double-click on it, it opens in a new window and the problem remains.
I have the same issue sometimes. In my case, I could replicate it 100% on one file but it was inconsistent on an virtually identical file. I also found the size error wasn't permanent -- I could save and reopen the file to restore the button's appearance. I could also create a new window and then discard the damaged window.
For me, the button resized when I accessed the sheet's HPageBreaks collection. I was able to avoid the problem by temporarily changing the window view as follows:
ActiveWindow.View = xlPageBreakPreview
' do pagination stuff using HPageBreaks
ActiveWindow.View = xlNormalView

Is it possible to have an extension library dialog box within a repeat control?

I'm running with an 8.5.3 UP1 server and I have a need to have many dialog boxes (for confirmation purposes) for a whole bunch of "action buttons" on an xpage. The code for these dialog boxes is almost exactly the same with the exception of the confirmation message being different and the client-side JS function they are calling if the Yes button is selected.
Since I really hate repeating code over and over, I was wondering if it is at all possible to put a xe:dialog control within a repeat control and specify the message and function call from an array of values? I know I can't compute the ID of the dialog control and without that I'm not sure how I would reference the dialog to open and close it.
Any ideas? Thanks
Yes, this is possible.
Make sure that you specify that the dialog box's property for keepComponents is set to False. You don;t have to do anything special for opening or closing the dialog box, just use whatever ID you give the dialog box in you client-side action to open the dialog box in the repeat such as XSP.openDialog('#{id:myDialog}')
The XPages renderer will automatically calculate the correct ID names for you.

Programmatically set "Select objects" cursor in Excel

I'm struggling to find out how to programmatically enable the "Select objects" cursor type. I checked the object browser and expected to find a property like Application.CursorType or Application.DrawingMode.
Changing the cursor type isn't picked up in the macro recorder and I must be searching for the wrong terms as I can't find information about this anywhere.
Edit: I should've made it clear I'm not talking about the cursor appearance that can be set via Application.Cursor. Rather, I want to set the cursor into the same mode as can be set via the GUI by clicking the "Select objects" icon on the Drawing toolbar. This is the cursor that only allows selection of shapes and ignores cells, text and the formula bar.
Actually, I never knew the correct name for this cursor mode until I checked the tooltip to write this update, perhaps that'll help.
I don't quite follow why you want to do this, but you can toggle the "Select Objects" drawing mode programmatically by executing the built-in CommandBar control:
Call CommandBars("Drawing").Controls("Select Objects").Execute
And you can determine the current mode by checking its state:
If CommandBars("Drawing").Controls("Select Objects").State Then
Call Debug.Print("Select Object mode is on")
End If
Good luck!
I'm a little 'late to the party' on this one but here is the answer to 'why he wants to do this' as well as 'what he wants to do'.
'Turn ON 'Select Objects' option during initial display. While ON, cell input is prevented.
If CommandBars("Drawing").Controls("Select Objects").State = False Then
CommandBars("Drawing").Controls("Select Objects").Execute
End If
I use this in a simple timer application which has one command button and two check boxes on the 'ActiveSheet' display. By turning ON 'Select Objects', I limit the cursor input targets to these three items. Cells cannot be selected.
Cheers,
Lawrence
Would this link help?
Here's a synopsis:
Over the application, you have four choices:
xlDefault
xlWait
xlBeam
xlNorthwestArrow
You call it like:
Application.Cursor = xlDefault
Over forms, you have more choices. See the article for more.
I don't know what you mean with 'drawing mode'. However, if you want to change the appearance of your mouse cursor, the property you are looking for is Application.Cursor
You can set it to one of four predefined values: xlWait, xlNorthwestArrow, xlIBeam and xlDefault.
If you want to display other cursors, have a look this article on how to display a custom cursor in Access. Since it uses the WinAPI, the solution should work equally in Excel.
Edit:
In response to your edit: I don't think that it is possible to do what you want. The macro recorder doesn't pick it up because there is no VBA command that can do it.
Depending and what you are trying to achieve by switching to design mode, there may be other ways though.
If you want to keep the user from changing the data in your workbook, you can hide the complete Excel window using the Application.Visible property.
If you want to keep the user from selecting or changinganything, but still display the data, have a look at ActiveSheet.Protect or ActiveWorkbook.Protect, available under Tools - Protection.
If you want to move or resize some controls in your workbook, you can do that programmatically by changing the Left, Top, Height and Width property of the control, you don't need to switch to design mode in order to do this from your macro.