Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default File input though some kind of windows interface

Hi all at the moment i use the following code

Sub ShowOpenTickets()
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Dim i As Long
Dim iAnz As Long
Const strWorkbook As String = "F:\Siemens\Auswertung.xls"
Const strSheet1 As String = "Auswertung"
Const strSheet2 As String = "Open Tickets - Solution"

Application.ScreenUpdating = False
Workbooks.Open strWorkbook

With ActiveWorkbook
Set wks1 = .Worksheets(strSheet1)
End With

On Error Resume Next
With ThisWorkbook
If .Worksheets(strSheet2) Is Nothing Then
..Worksheets.Add.Name = strSheet2
End If
On Error GoTo 0

Set wks2 = .Worksheets(strSheet2)
wks2.Cells.Clear

For i = 1 To wks1.Cells(Rows.Count, "D").End(xlUp).Row
Select Case wks1.Cells(i, "D").Value
Case "in work", "assigned", "Status", "new"
Select Case Left(wks1.Cells(i, "K").Value, 3)
Case "SOL", "Pro"
iAnz = iAnz + 1
wks2.Rows(iAnz).Value = wks1.Rows(i).Value
End Select
End Select
Next i
End With
ActiveWorkbook.Close
Application.ScreenUpdating = True
MsgBox "Es wurden " & iAnz & " offene Tickets übertragen"
End Sub

to bring data from one excel file into another one. But it works only with
conastant values like
Const strWorkbook As String = "F:\Siemens\Auswertung.xls"
Const strSheet1 As String = "Auswertung"
Const strSheet2 As String = "Open Tickets - Solution"

Is this possible to make some kind of interface so that the user can decide
which file to take, interface like one in windows where i can decide which
file to open for example.

Thanks alot in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default File input though some kind of windows interface

Philipp,

Take a look at the "GetOpenFileName" method.
It Displays the standard Open dialog box and gets a file name from the user without actually opening any files.

Regards,
Jim Cone
San Francisco, CA

"Philipp Oberleitner" wrote in message ...
Hi all at the moment i use the following code

- snip -
to bring data from one excel file into another one. But it works only with
constant values...

- snip -
Is this possible to make some kind of interface so that the user can decide
which file to take, interface like one in windows where i can decide which
file to open for example.
Thanks alot in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default File input though some kind of windows interface

Look in Excel help at the

Application.GetOpenfileName command. It shows the file open dialog and
returns the selected file as a string which you can assign to the variable
strWorkbook

--
Regards,
Tom Ogilvy

"Philipp Oberleitner" wrote in message
...
Hi all at the moment i use the following code

Sub ShowOpenTickets()
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Dim i As Long
Dim iAnz As Long
Const strWorkbook As String = "F:\Siemens\Auswertung.xls"
Const strSheet1 As String = "Auswertung"
Const strSheet2 As String = "Open Tickets - Solution"

Application.ScreenUpdating = False
Workbooks.Open strWorkbook

With ActiveWorkbook
Set wks1 = .Worksheets(strSheet1)
End With

On Error Resume Next
With ThisWorkbook
If .Worksheets(strSheet2) Is Nothing Then
.Worksheets.Add.Name = strSheet2
End If
On Error GoTo 0

Set wks2 = .Worksheets(strSheet2)
wks2.Cells.Clear

For i = 1 To wks1.Cells(Rows.Count, "D").End(xlUp).Row
Select Case wks1.Cells(i, "D").Value
Case "in work", "assigned", "Status", "new"
Select Case Left(wks1.Cells(i, "K").Value, 3)
Case "SOL", "Pro"
iAnz = iAnz + 1
wks2.Rows(iAnz).Value = wks1.Rows(i).Value
End Select
End Select
Next i
End With
ActiveWorkbook.Close
Application.ScreenUpdating = True
MsgBox "Es wurden " & iAnz & " offene Tickets übertragen"
End Sub

to bring data from one excel file into another one. But it works only with
conastant values like
Const strWorkbook As String = "F:\Siemens\Auswertung.xls"
Const strSheet1 As String = "Auswertung"
Const strSheet2 As String = "Open Tickets - Solution"

Is this possible to make some kind of interface so that the user can

decide
which file to take, interface like one in windows where i can decide which
file to open for example.

Thanks alot in advance




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
Extracting data from one xls file and input into another xls file trainerbro Excel Discussion (Misc queries) 1 November 1st 06 08:57 PM
new windows for new excel file vincentnyc Excel Discussion (Misc queries) 2 September 12th 06 04:08 PM
Here is fix for Windows file problems Patricia Shannon New Users to Excel 2 April 25th 06 03:25 PM
Here is fix for Windows file problems Patricia Shannon Excel Discussion (Misc queries) 0 April 15th 06 01:03 AM
some kind of meta-way to refer to sheet and file names in Excel? GoBobbyGo Excel Discussion (Misc queries) 7 February 22nd 06 03:05 PM


All times are GMT +1. The time now is 05:11 AM.

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"