LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Macros Issue Sara Excel Discussion (Misc queries) 2 February 18th 09 04:51 PM
Excel Worksheet Password Issue!!!!! nitro Excel Discussion (Misc queries) 2 June 29th 07 10:42 AM
VB macros issue with selecting cells on different page Sunny Excel Discussion (Misc queries) 1 March 17th 07 01:07 AM
Macros in Excel Worksheet dknorwood Excel Discussion (Misc queries) 7 July 13th 06 03:05 AM
Debug issue with macros Jess Excel Programming 1 June 23rd 04 03:54 PM


All times are GMT +1. The time now is 11:12 PM.

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"