View Full Version : [SLEEPER:] activate an already open workbook or open if not open
jmutsche
12-10-2013, 10:43 AM
fname = "\\pmi.corp\dfsroot\HumanDev\QA\Staff\MPP\Leadership (file://\\pmi.corp\dfsroot\HumanDev\QA\Staff\MPP\Leadership) Reporting\MPP-All Data Combined File (Work Pending).xlsx"
Workbooks.Open Filename:=fname, UpdateLinks:=0
How would I go about writing an if statement saying to activate this workbook if its open or open it if its not?
jmutsche
12-10-2013, 11:03 AM
fname = "\\pmi.corp\dfsroot\HumanDev\QA\Staff\MPP\Leadership (file://\\pmi.corp\dfsroot\HumanDev\QA\Staff\MPP\Leadership) Reporting\MPP-All Data Combined File (Work Pending).xlsx"
If WBisOpen(fname) Then
'......
Else
Workbooks.Open Filename:=fname, UpdateLinks:=0
End If
then I just called the function
Function WBisOpen(fname As String) As Boolean
Dim wb As Workbook
On Error Resume Next
Set wb = Workbooks(fname)
On Error GoTo 0
WBisOpen = Not wb Is Nothing
End Function
Can you please wrap VBA code in code tags ?
Did you read post #2 ?
jmutsche
12-10-2013, 05:48 PM
Can you please wrap VBA code in code tags ?
Did you read post #2 ?
Ya. It didnt work. It like opened it but it wouldn't activate the workbook. Also how do u wrap code in tags?
jmutsche
12-10-2013, 05:52 PM
Can you please wrap VBA code in code tags ?
Did you read post #2 ?
I tries but it didn't work. It opened the workbook one time but then it just disapeared. Also how do I wrap the code in tags?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.