Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am using macro code to show an "Open file"-dialog via Excel wich i found here: http://qlikviewmaven.blogspot.se/2009/03/browse-for-file-macro-button.html
Sub Browse_for_File
Set oXL=CreateObject("Excel.Application")
f_name=oXL.GetOpenFilename("All Files (*.*),*.*",,"Select file",False)
If f_name="False" then
Set oXL=nothing
Exit sub
End If
ret=ActiveDocument.GetVariable("file_pathname").SetContent(f_name,false)
Set oXL=nothing
Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate "QlikView - [Test]"
Set objShell=Nothing
End Sub
The problem is that when i use the sub, qlikview looses focus and another window gets focus.
Is there a way to solve this? Tried objShell.AppActivate
Won't even work when i loop through names and get the window title from the application..
Attached is a test application.
Cheers,
Martin
Forgot to attach application, here it is.
Did you get it working?
Just as idea - including a declaration from the qv-app within the sub-statement and call this as last action could help:
sub x
set doc = ActiveDocument
... excel-code
doc.Sheets("Main").Activate
end sub
Also should a closing from excel return the focus to the previous window.
sub x
...
oXL.close
oXL.quit
end sub
- Marcus