Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd issue with an Excel worksheet using macros
I am trying to fix a problem with a workbook and macros within the workbook.
Here is the issue: I open a workbook that contains macros in another workbook. The files are located on a server under a mapped drive in windows. The workbook is a .xls not xlsx. I run a macro that creates a fax and faxes it. The first time I run it, it faxes some of the workbook fine but if I attempt to run the same macro again I get the following error: Run-time error 1004 Fax_A.xls could not be found. Check the spelling of the name. From trouble shooting I have determined that excel does not know the location of the specified workbook. So if I click on the explorer icon in excel, and go to the folder the workbook is located in, it runs fine. Then if I try another time, I get the same error. When I open the explorer icon in excel, it is looking at the "Office12" folder instead of the folder that the workbooks are located in. I have changed the default file location in excel to point to the folder that contains the files but it still defaults back to "office12" one the macro is ran and the file is faxed. Here is a snippet of the code in the macro: '--------------------------------------------------------- ' SendFax Macros ' Macro recorded 6/30/97 by ' '--------------------------------------------------------- Sub SendFax_A() PriceList = "FAX_A.XLS" Application.Run Macro:="MASTER.XLS!Send_a_Fax" End Sub Sub Send_a_Fax() Workbooks.Open Filename:=PriceList, UpdateLinks:=1 Windows(PriceList).Activate ActiveWindow.Visible = True 'MsgBox Application.ActivePrinter Application.ActivePrinter = TheFAX On Error Resume Next ActiveWindow.SelectedSheets.PrintOut Copies:=1 ' AppActivate "Delrina WinFax PRO" ' SendKeys "%S", True 'Send ' SendKeys "F", True 'Fax ' SendKeys "%T", True 'To: ' SendKeys "Test", True ' SendKeys "%G", True 'Group ' SendKeys "%L", True 'Add to List DoEvents ' Windows(PriceList).Activate ActiveWorkbook.Save ActiveWorkbook.Close (False) End Sub '--------------------------------------------------------- ' Auto_Close Macro ' Macro recorded 7/7/97 '--------------------------------------------------------- Sub Auto_Close() Windows("MASTER.XLS").Activate ActiveWorkbook.Save ActiveWorkbook.Close End Sub '--------------------------------------------------------- ' WIP Macro ' Macro recorded 7/8/97 ' '--------------------------------------------------------- Sub WIP() MsgBox "This button is not implemented, please press OK." End Sub ' When I place the path of the file in the routine like this: Sub SendFax_A() PriceList = "O:\New Master\FAX_A.XLS" Application.Run Macro:="MASTER.XLS!Send_a_Fax" End Sub Sub Send_a_Fax() Workbooks.Open Filename:=PriceList, UpdateLinks:=1 Windows(PriceList).Activate ActiveWindow.Visible = True I receive the following error: Run-time error '9': Subscript out of Range" Any thoughts? Thanks in advance for all your help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macros Issue | Excel Discussion (Misc queries) | |||
Excel Worksheet Password Issue!!!!! | Excel Discussion (Misc queries) | |||
VB macros issue with selecting cells on different page | Excel Discussion (Misc queries) | |||
Macros in Excel Worksheet | Excel Discussion (Misc queries) | |||
Debug issue with macros | Excel Programming |