Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Excel macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Macro to close excel okanem Excel Discussion (Misc queries) 1 July 19th 05 10:01 AM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM
Excel macro that opens new MS Word file and pastes data as a pictu Rob Excel Worksheet Functions 0 July 6th 05 05:12 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"