How to get text from status bar in SAP GUI - vba

I'm tying to automate a certain process in SAP GUI. But I can't get the script this specific part.
It reads until I double click in this field shown in color green.
After that the following window is opened:
How do I get this number in VBA? Any ideas?

Related

How can I ensure that the "details" task pane in microsoft project vba is NOT displayed

I have an application in Microsoft project that performs a Backtrace of a task and then uses the following to save that image to an Excel Tab
Application.EditCopyPicture Object:=False, ForPrinter:=0, SelectedRows:=0, FromDate:=EarliestStart, ToDate:=LFin, ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
definitions for msome of the variables used in the procedure:
EarliestStart = StatusDate-30
Lfin = Finish of the target Task for the Backtrace, which would be the last task in the string.
I use a flag field to identify tasks that I want to create a backtrace for and then cycle through all the tasks to create the Backtrace images and saving them to a unique excel tab.
Every so often, my app "creates a secondary task pane" using the same view that I am using in the top half of the split screen. I do not want a split screen with the bottom half of the screen displayed. When I have a split screen, my application
Is there a vba command that I can use in code that will test for the presence of a secondary task pane and if present, clear it. I have been looking for something that would test the Ribbon task\details checkbox but have been unable to find it.
If before running the application I remove the secondary pane, it runs fine. If I start to run the vba with a secondary pane showing, it brings up a View "View" dialog.
I have experimented with:
ViewApplyEx SinglePane:=True, ApplyTo:=1
but this displays the View"Views" dialog and forces me to select a view from the list, which is not what I want to do.
Any suggestions as to where I should look?
The method you are looking for is PaneClose. It will close the lower pane of the active window. It does nothing if the lower pane was already closed. So do this:
Application.PaneClose
Application.EditCopyPicture Object:=False, ForPrinter:=0, SelectedRows:=0, FromDate:=EarliestStart, ToDate:=LFin, ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2

How to increase the size of input box in MS Access reports or forms based on user input?

I have a text box in MS Access Report which is set to unbound. I want to be able to collect an address in that field which can be any length based upon the customer address. I right clicked the box and set the size property to "To-Fit". However this did not do anything at all. The report needs to be printed which is why I cannot have a part of an address cut off because of the size of the text box.
Is there a way to make the size of the text box dynamic?
Thank you
Unfortunately there is no such feature for reports. For form controls you could use Horizontal Anchor but not for reports.
So you have two possibilities to let your adress not be cutted:
1: Let it grow vertically
To achieve this you would have to set the property Can grow of both, the textbox and the containing section to Yes.
If the text now doesn't fit in the textbox it will be resized in height.
2: Control it via VBA
You could use the format event to control the width of the textbox via VBA.
Here is an example of how to do this, but I didn't ever try it.
Unfortunately it is in mdb format, so you would need an older Microsoft Access Version (I expect Microsoft Access 2007 should be able to, 2003 for sure) to open it and grab the code.
http://www.lebans.com/autosize_textbox.htm
It uses Windows APIs and could be not so easy to get it running.
What it does (just the steps):
It first calculates the width of the text to be displayed in respect to the current font, fontsize and its properties.
Knowing this the control can be resized regarding.

Copying text from popup window

My employer uses SAP to generate purchase order numbers. The PO number is displayed in a popup window. I need to use a VBA script to copy the PO number (or the whole text) so that it can be pasted into Excel.
I have tried using the script recording tool to get the command (it doesn't record the mouse clicks to select and copy, nor the keyboard commands), and it won't let me print to One Note or Microsoft XPS Document Writer.
Any suggestions would be greatly appreciated. Image of the popup window is here:
The message is displayed in the status bar at the lower end of the screen.
with VBA you can read this as follows:
STATUS_BAR_TEXT = session.findById("wnd[0]/sbar").Text

How to access an external application using vba which responds only to mouse clicks

I am trying to automate a task at work using vba where i load certain files to an application and generate a zip file. But this application doesn't respond to keyboard commands while loading a file. I'll have to double click the mouse next to the file name and select the file. Any idea how i can automate this using vba? I am not a great coder, so any kind of help would be appreciated.
Thanks in advance As shown in this picture, the select option appears only when i click the mouse in the specific tab, and I'll have to click again to select the file

VBA script to insert anchor position for autoshapes in Microsoft Word 2007

I'm beyond the limits of my kindergarten-level VBA skills so would like to ask if anyone here can help me write a VBA script to help me work stepwise through my Word document and adjust the anchoring position of all the AutoShapes in the document.
I have a 400-page book in Microsoft Word with at least one and sometimes several marginalia (sidenote) on each page in a thin column to the left of the main body text column. These sidenotes are a concise 'pointer' to a particular point made in the body text and need to appear directly to that point's left.
Each sidenote is in its own AutoShape (within a textbox in that shape). The AutoShapes were placed by the author in an inconsistent way. Mostly they are anchored to a position on the page.
However, I need to repaginate. This will cause the body text to flow differently and I need the sidenotes to flow with it (approximately or exactly)!
So before I repaginate I want to make sure I anchor each AutoShape to the paragraph it belongs to and not to the page it is currently on.
I don't know if that can be done automatically, since I don't know how Word could deduce a purely spatial relationship between an AutoShape and a paragraph.
So I'm guessing I have to make do with a "semi-automatic" process. Something like this:
Press a button to start VBA script
Select next AutoShape
Prompt for user to enter cursor in body text where anchor is to be placed
Resume macro
Place anchor for that AutoShape in that position
Change vertical position paramater of AutoShape to "relative to paragraph"
and "0 mm"
(Alternative, not 0 mm but another value deduced to more
accurately position AutoShape)
Change width parameter of AutoShape to
a particular fixed value 37 mm (some of them were a little
inaccurately drawn)
End cycle and go back to beginning to
Select next AutoShape
Hope that is all understandable.
I've tried to record a VBA script to do some of this but have no idea how to build in the user prompt.
Any help much appreciated!
Craig
You may be better off creating a macro that works on one shape at a time, or anchor all the shapes manually (which you're almost doing anyway) and then write a macro to take care of the various parameters and settings you want.
If you really want to prompt the user while the macro is running you'll need to look into modeless dialogs (not possible on the Mac). See this link: http://www.bettersolutions.com/vba/VXV113/SE846743531.htm
Basically, you'd have to create your own dialog and then show it modelessly so that the user could still place the cursor before hitting OK. If you're new to VBA, this could be difficult to set up.
While searching for solutions to this, I found a post on another forum from someone trying to do something very similar. He was developing a set of tools for editors using Word and until I find the ultimate solution I am using his "Shapes" tool which allows me to change parameters on each AutoShape I select at-a-click instead of opening up and closing a dialogue box each time, plus selecting a different tab each time... His tools can be downloaded at his Editors' Toolkit website.