Thanks Strongm! Nice piece of code. But I usually use SendMessage API to maipulate mouse cursor, click etc. I thought that mouse-move is able to 'move' the cursor not to bring it in a specific position. On my taste, SetCursorPos is a little easyer to use... I found the problem in my 'mouse_move'...
Solved...
I looped 10 times through the sequence of SetCursorPos. I tried that before posting but now I added DoEvents.
Dim i As Long
For i = 1 To 10
SetCursorPos ContextMenuInfo(2) - (30 + i), ContextMenuInfo(4) + 15
DoEvents
Next
ContextMenuInfo(2) keeps window...
I need to simulate the mouse over a window of another application. I mean to trigger Mouse Move event... When I manually move the mouse over that specific window another window appears. I can determine the handle of that specific window, I know its X and Y, Top and Bottom positions and I can set...
Of course it is a mistake here:
Sub RefreshRibbon()
Set rIBONUL = GetRibbon(ThisWorkbook.Sheets("Memorie").Range("B1").Value)
End Sub
It should be:
Sub RefreshRibbon()
Set rIBB = GetRibbon(ThisWorkbook.Sheets("Memorie").Range("B1").Value)
End Sub
Solved the problem (based on Rory Archibald via Ron de Bruin sample):
Initializing code becomes:
Public rIBB As IRibbonUI
Sub Initializare(Ribbon As IRibbonUI)
Set rIBB = Ribbon
ThisWorkbook.Sheets("Memorie").Range("B1").Value = ObjPtr(Ribbon)
End Sub
The pointer to the Ribbon Object is...
Another thing:
When it works well the code:
Debug.Print rIBB Is Nothing
returns False.
When it does not work well it returns True meaning that riBB became Nothing...
It looks that my way of calling 'Initializare' is unappropriate. Can anybody help on this issue?
I use an Excel 2007 addin (xlam) and in order to change some control labels, tips, images its XML code contains an 'onLoad' procedure named "Initializare":
Public rIBB As IRibbonUI
Sub Initializare(Ribbon As IRibbonUI)
Set rIBB = Ribbon
End Sub
Most of time it works well except some...
Basically you can open Excel from VBScript and do whatever there using this piece of code:
Set Ex = CreateObject("Excel.Application")
With Ex
.Visible = False 'true
.Workbooks.Open ("D:\MyPath\MyWorkbook.xls")
a = .Workbooks("MyWorkbook.xls").Sheets(1).Cells(1,1).Value...
I solve it but in a strange manner...
This line does not work (x defined like "q"):
With ExcelDeschis
.Run "'MyWokbook to be called.xlsm'!myProc", x
End With
But this one works:
With ExcelDeschis
.Run "'MyWokbook to be called.xlsm'!myProc", "q"
End With
I used this...
I figured it out but in a little stange manner...
This line of code:
" .Run " & Chr(34) & "'" & Z & "'!myProc""" & ", Drive" & vbCrLf & _
has been replatec with this one:
" .Run " & Chr(34) & "'" & Z & "'!myProc""," & " chr(34) & Drive & chr(34)" & vbCrLf & _
What is strange: It does...
The next script finds the open session of Excel and call procedure 'MyProc'. It works without passing an argument. I mean the procedure is called if I do not add ', x'. When I tray to pass the argument it looks that it is a sintax probmem in the code...
x = "q"
Set ExcelDeschis =...
...& vbCrLf
x = x & "Set colMonitoredEvents = objWMIService.ExecNotificationQuery(""Select * from Win32_VolumeChangeEvent"")" & vbCrLf
x = x & "Do" & vbCrLf
x = x & " Set objLatestEvent = colMonitoredEvents.NextEvent" & vbCrLf
x = x & " If objLatestEvent.DriveName <> """" And...
...colMonitoredEvents As Variant
Sub StartTimer()
TimerSeconds = 5 ' how often timer works (sec).
TimerID = SetTimer(0&, 0&, TimerSeconds * 1000, AddressOf Timer_Proc)
End Sub
Sub StopTimer()
On Error Resume Next
KillTimer 0, TimerID
End Sub
Sub Timer_Proc(ByVal HWnd As...
Thanks Tony!
It starts from My Computer indeed like the simpler code from VBScript forum posted above and like this one beside your string message it shows also 'Browse for Folder'. Even if I intend to browse for drive I think I have to let it showing whatever it wants...
I hopped that...
Sorry Gavona, I missed your point… I was so focused on my idea that I did not read with enough attention what you suggested. It can be a solution, indeed.
But, I refuse do believe that it is not possible to start browsing from My Computer using that FileDialog…
Can anybody else find a...
In the meantime I found this piece of code in VBScript forum which starts browsing in My Computer (if sInitPath = 17) and I adapted a little:
Function getDriveLetter(sCaption, sInitPath)
Dim oShell As Object, oFolder As Object, oFolderItem As Object
Dim return_ As String
Set oShell =...
Thanks mintjulep! I am a little cleverer now but I still do not know how to solve the issue...
Thanks Gabona, but I do not need a way to obtain the list of existing drives. I need to memorize a specific drive (checked to be external) selected by user. I can do that with the code posted...
I have an addin needing to set the drive where the back-up to be done. It should be an external media (HD or memory stick). I know how to identify/check if it is external media and I have the next function in order to Browse for a folder:
Function GetDrive() As Variant
Dim fldr As...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.