Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi and thanks of the answer
I have solved my problem. There were needed a little bit more, a function, which I copied from MS's article (ID 151336). The macro is working correctly now, but... Every time I run the macro and the base workbook/File is open Excel asks me that 'if the workbook is opened again I'll lost someting unsaved'. And I must answer 'YES'. There is no unsaved data in the workbook, and that's why I'd like to give the answer inside the code. How and where? I copy my new code here. Sub Kaavapoiminta() ' ' Kaavapoiminta Makro ' kukkoha on nauhoittanut makron 24.11.2005. ' If IsOpen("\\taskes000001\keto\Petri\Tuotantoalueet\t uotantoalueet.xls") Then Workbooks("tuotantoalueet.xls").Sheets("Taul1").Ra nge("tuotantoalueet"). _ AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("Ehdot"), _ CopyToRange:=Range("Poimi"), Unique:=False Else Workbooks.Open(Filename:= _ "\\taskes000001\keto\Petri\Tuotantoalueet\tuotanto alueet.xls").RunAutoMacros _ Which:=xlAutoOpen ActiveWindow.WindowState = xlMinimized ActiveWindow.WindowState = xlMaximized Workbooks("tuotantoalueet.xls").Sheets("Taul1").Ra nge("tuotantoalueet"). _ AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("Ehdot"), _ CopyToRange:=Range("Poimi"), Unique:=False End If End Sub Function IsOpen(Filename As String) As Boolean Dim wb As Workbook For Each wb In Application.Workbooks If UCase(wb.Name) = UCase(Filename) Then IsOpen = True Exit Function End If Next wb IsOpen = False End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro Help In Excel | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Macro to close excel | Excel Discussion (Misc queries) | |||
passing arguments from an excel macro to a word macro | Excel Discussion (Misc queries) | |||
Excel macro that opens new MS Word file and pastes data as a pictu | Excel Worksheet Functions |