Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Why does this not work with shortcut (EX97)

Hello together!
I am a new member from Germany and I need som help from you!
I wrote this code below to copy the content of sheet(1) of all
Excel-Files in one specified directory together in one single sheet of
the Workbook containing the Macro, ignoring all formatting, amount of
data, formula etc.
The code works and does everything it should do, if i start it from the
VB-Editor or via ALT+F8.
If i assign a shortcut to the macro, lets say CTRL+SHIFT+z, then the
code stops immediately after opening one of the files to copy.
How can I avoid this and use a shortcut, to make the use easyer for our
customers?
I tried hiding the "incoming" file while importing the sheet and ODBC
(here I got problems with files from different EXCEL-Versions) to
access the files, but I always got problems with stopping code while
using a shortcut to start the macro-code.
Thank you for all help and greetings from Germany

Uwe

Code:


Public Sub Zusammenkopieren()
'
' Zusammenkopieren Makro
' Copyright 16.09.2003, Uwe Christian
'
'
'
Dim vPfadName As String, vDateiname As String, vZelle As String
Dim vFS As FileSearch
Dim vAktDN As String
Dim i As Long, vZeile As Long

vPfadName = InputBox("Bitte den Namen des Datei-Pfades angeben: ",
"PfadName eingeben")
If vPfadName = "" Then Exit Sub
Set vFS = Application.FileSearch

With vFS
.LookIn = vPfadName
.FileName = "*.xls"
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Application.Workbooks.Open .FoundFiles.Item(i)
vDateiname = ActiveWorkbook.Name
vZelle =
Application.Workbooks(vDateiname).Sheets(1).Range( "A1").SpecialCells(xlLastCell).Address
Range("A1", vZelle).Copy
vZeile =
ThisWorkbook.Sheets(1).Range("A1").SpecialCells(xl LastCell).Row
ThisWorkbook.Sheets(1).Range("A" &
Trim(CStr(vZeile))).PasteSpecial xlPasteAll
Application.CutCopyMode = False
Application.Workbooks(vDateiname).Close False
Next i
Else
MsgBox "Keine Dateien zum Einfügen gefunden."
End If

End With

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why does this not work with shortcut (EX97)

Don't use a shortcut that includes the Shift key.

--
Regards,
Tom Ogilvy


"miedelsbacher" wrote in message
...
Hello together!
I am a new member from Germany and I need som help from you!
I wrote this code below to copy the content of sheet(1) of all
Excel-Files in one specified directory together in one single sheet of
the Workbook containing the Macro, ignoring all formatting, amount of
data, formula etc.
The code works and does everything it should do, if i start it from the
VB-Editor or via ALT+F8.
If i assign a shortcut to the macro, lets say CTRL+SHIFT+z, then the
code stops immediately after opening one of the files to copy.
How can I avoid this and use a shortcut, to make the use easyer for our
customers?
I tried hiding the "incoming" file while importing the sheet and ODBC
(here I got problems with files from different EXCEL-Versions) to
access the files, but I always got problems with stopping code while
using a shortcut to start the macro-code.
Thank you for all help and greetings from Germany

Uwe

Code:


Public Sub Zusammenkopieren()
'
' Zusammenkopieren Makro
' Copyright 16.09.2003, Uwe Christian
'
'
'
Dim vPfadName As String, vDateiname As String, vZelle As String
Dim vFS As FileSearch
Dim vAktDN As String
Dim i As Long, vZeile As Long

vPfadName = InputBox("Bitte den Namen des Datei-Pfades angeben: ",
"PfadName eingeben")
If vPfadName = "" Then Exit Sub
Set vFS = Application.FileSearch

With vFS
LookIn = vPfadName
FileName = "*.xls"
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Application.Workbooks.Open .FoundFiles.Item(i)
vDateiname = ActiveWorkbook.Name
vZelle =

Application.Workbooks(vDateiname).Sheets(1).Range( "A1").SpecialCells(xlLastC
ell).Address
Range("A1", vZelle).Copy
vZeile =
ThisWorkbook.Sheets(1).Range("A1").SpecialCells(xl LastCell).Row
ThisWorkbook.Sheets(1).Range("A" &
Trim(CStr(vZeile))).PasteSpecial xlPasteAll
Application.CutCopyMode = False
Application.Workbooks(vDateiname).Close False
Next i
Else
MsgBox "Keine Dateien zum Einfügen gefunden."
End If

End With

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
Excel 2007 Shortcut do not work JHL Excel Discussion (Misc queries) 5 October 28th 09 04:00 PM
Why doesnt shortcut key work on some but not on others? Craig Excel Discussion (Misc queries) 3 August 12th 08 03:20 PM
Shortcut does not work Luiz Carvalho Excel Discussion (Misc queries) 2 December 18th 06 04:40 PM
macro shortcut keys don't work andr01d Excel Discussion (Misc queries) 1 February 3rd 06 05:40 PM
Shift+Shortcut Key does not work Allen[_7_] Excel Programming 2 September 16th 03 02:22 PM


All times are GMT +1. The time now is 10:53 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"