Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
In my addin I'm opening file through workbooks.open. Till now it's allright. But when I want to pass workbook to other subs I'm receiving error "subscript out of range". Here is my code: #addin Sub RaportPlat() Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogOpen) With fd .Filters.Add "Raport płatności", "*.xls", 1 .Show End With Workbooks.Open Filename:=fd.SelectedItems(1) Copy_Rows_Wejscie_Nieuslugi (fd.SelectedItems(1)) passing workbook to sub: Sub Copy_Rows_Wejscie_Nieuslugi(WorkbookName As String) 'workbooks(WorkbookName).Activate Dim RngCol As Range Dim i As Range Workbooks(WorkbookName).Worksheets("wejscie nieuslugi") = ActiveSheet here i'm receiving error. How can I resolve it, please? TIA Przemek |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Przemek,
Probably because the name is path and name. Try Copy_Rows_Wejscie_Nieuslugi (Activeworkbook.Name) -- HTH RP (remove nothere from the email address if mailing direct) "Przemek" wrote in message oups.com... Hi, In my addin I'm opening file through workbooks.open. Till now it's allright. But when I want to pass workbook to other subs I'm receiving error "subscript out of range". Here is my code: #addin Sub RaportPlat() Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogOpen) With fd .Filters.Add "Raport płatności", "*.xls", 1 .Show End With Workbooks.Open Filename:=fd.SelectedItems(1) Copy_Rows_Wejscie_Nieuslugi (fd.SelectedItems(1)) passing workbook to sub: Sub Copy_Rows_Wejscie_Nieuslugi(WorkbookName As String) 'workbooks(WorkbookName).Activate Dim RngCol As Range Dim i As Range Workbooks(WorkbookName).Worksheets("wejscie nieuslugi") = ActiveSheet here i'm receiving error. How can I resolve it, please? TIA Przemek |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pass variable from one workbook to another | Excel Discussion (Misc queries) | |||
Pass workbook name to ActiveX DLL (VB6) | Excel Discussion (Misc queries) | |||
Pass an argument to Excel workbook | Excel Programming | |||
<Pass the Torch from a Closing Workbook | Excel Programming | |||
<Pass the Torch from a Closing Workbook | Excel Programming |