D
dk_
Below is my macro that works 'perfectly', cross-platform on both Windows
Excel97 and Mac OS 9, Excel 98, except...
My problem is that I am using '6 edited individual macros', rather than just
'a single macro' for 6 workbooks that call the macro.
How can I have my macro set a file name in the macro to that of the
workbook's name that is calling the macro???
I currently run an 'edited copy' of my macro (see below), from within 6
different workbooks by clicking a button in the open workbook
The macro finds and opens a specific workbook named "a_DK.xls" in the
current directory and copies a named range "QuoteArea", then re-activates
the workbook that called the macro (e.g."Ben.xls"), pastes the data, and
then finally closes "a_DK.xls", (the data-source workbook).
My problem is that in each of 6 copies of my macro, I've had to
change/customize a 'file name' in the macro to that of the 'file name of the
current active workbook's name' which is calling the macro.
See the 5th line: *_Windows("Ben.xls") *, [in my macro below]...
I've had to customize/change the file name "Ben.xls" to the name of the
workbook that I call the macro from. (I've had to create a seperate macro
for each of my 6 workbooks).
Sub QuoteCopy_Ben()
Application.ScreenUpdating = False
mydir = ActiveWorkbook.Path
Workbooks.Open FileName:=mydir & Application.PathSeparator & "a_DK.xls"
Range("QuoteArea").Copy
Windows("Ben.xls").Activate ' <--NEED TO EDIT THE WORKBOOK NAME HERE
Range("QuoteDate").Select
ActiveSheet.Paste
Range("QuoteDate").Select
Windows("a_DSK.xls").Activate
Application.CutCopyMode = False
Range("dkquotedate").Select
Application.ScreenUpdating = True
ActiveWindow.Close
End Sub
Thanks for loooking.
-Dennis
Excel97 and Mac OS 9, Excel 98, except...
My problem is that I am using '6 edited individual macros', rather than just
'a single macro' for 6 workbooks that call the macro.
How can I have my macro set a file name in the macro to that of the
workbook's name that is calling the macro???
I currently run an 'edited copy' of my macro (see below), from within 6
different workbooks by clicking a button in the open workbook
The macro finds and opens a specific workbook named "a_DK.xls" in the
current directory and copies a named range "QuoteArea", then re-activates
the workbook that called the macro (e.g."Ben.xls"), pastes the data, and
then finally closes "a_DK.xls", (the data-source workbook).
My problem is that in each of 6 copies of my macro, I've had to
change/customize a 'file name' in the macro to that of the 'file name of the
current active workbook's name' which is calling the macro.
See the 5th line: *_Windows("Ben.xls") *, [in my macro below]...
I've had to customize/change the file name "Ben.xls" to the name of the
workbook that I call the macro from. (I've had to create a seperate macro
for each of my 6 workbooks).
Sub QuoteCopy_Ben()
Application.ScreenUpdating = False
mydir = ActiveWorkbook.Path
Workbooks.Open FileName:=mydir & Application.PathSeparator & "a_DK.xls"
Range("QuoteArea").Copy
Windows("Ben.xls").Activate ' <--NEED TO EDIT THE WORKBOOK NAME HERE
Range("QuoteDate").Select
ActiveSheet.Paste
Range("QuoteDate").Select
Windows("a_DSK.xls").Activate
Application.CutCopyMode = False
Range("dkquotedate").Select
Application.ScreenUpdating = True
ActiveWindow.Close
End Sub
Thanks for loooking.
-Dennis