Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Andrzej
 
Posts: n/a
Default How to open file in the background. It is possible?


I would like to open file, but I do not want to people saw this.

I have a code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim szukana As Range
Dim Cecha As String
Dim bk As Workbook
Dim sh As Worksheet
Dim sh1 As Worksheet

If Not Application.Intersect(Columns("A:A"), Target) _
Is Nothing Then
Cecha = Target.Value

If Cecha = "" Then Exit Sub
On Error Resume Next
Set bk = Workbooks(p1.xls)
On Error GoTo 0
If bk Is Nothing Then
Set bk = Workbooks.Open(Filename:="H:\....p1.xls")
End If

Set sh1 = bk.Worksheets(bk.Worksheets.Count)
For Each sh In bk.Worksheets
Set szukana = sh.Cells.Find(What:=Cecha, _
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
If szukana Is Nothing Then
If sh.Name = sh1.Name Then
MsgBox "Sorry, but " & Cecha & " was not found"
ActiveWorkbook.Close
Target.Value = ""

End If
Else
bk.Activate
sh.Activate
szukana.Activate
MsgBox "Szukana cecha " & Cecha & " was found"
ActiveWorkbook.Close

End If
Next sh

End If

End Sub



  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

Use the ScreenUpdating property. E.g.,

Application.ScreenUpdating = False
' your code here
Application.ScreenUpdating = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Andrzej" wrote in message
...

I would like to open file, but I do not want to people saw
this.

I have a code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim szukana As Range
Dim Cecha As String
Dim bk As Workbook
Dim sh As Worksheet
Dim sh1 As Worksheet

If Not Application.Intersect(Columns("A:A"), Target) _
Is Nothing Then
Cecha = Target.Value

If Cecha = "" Then Exit Sub
On Error Resume Next
Set bk = Workbooks(p1.xls)
On Error GoTo 0
If bk Is Nothing Then
Set bk = Workbooks.Open(Filename:="H:\....p1.xls")
End If

Set sh1 = bk.Worksheets(bk.Worksheets.Count)
For Each sh In bk.Worksheets
Set szukana = sh.Cells.Find(What:=Cecha, _
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
If szukana Is Nothing Then
If sh.Name = sh1.Name Then
MsgBox "Sorry, but " & Cecha & " was not found"
ActiveWorkbook.Close
Target.Value = ""

End If
Else
bk.Activate
sh.Activate
szukana.Activate
MsgBox "Szukana cecha " & Cecha & " was found"
ActiveWorkbook.Close

End If
Next sh

End If

End Sub





Reply
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
Saved *.csv file gives SYLK file type warning upon Excel 2003 open Tom Excel Discussion (Misc queries) 5 March 19th 08 04:15 PM
file open via IE hyperlink causes already open files to shrink and tile Marc Setting up and Configuration of Excel 0 May 4th 05 08:13 PM
hidden rows & columns slow file open Simon Shaw Excel Discussion (Misc queries) 0 April 5th 05 12:21 AM
Cannot open a file that Excel says is open Plodhia Excel Discussion (Misc queries) 2 December 7th 04 02:43 AM
format question when open csv file Jeff Excel Discussion (Misc queries) 1 December 1st 04 07:53 PM


All times are GMT +1. The time now is 06:13 PM.

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

About Us

"It's about Microsoft Excel"