Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Code from Shared Workbook

Status
Not open for further replies.

SpaaamCatcher

Technical User
Aug 21, 2003
19
US
Hi, there. I need to find a way to run code from a shared workbook whereby one of the spreadsheets is saved off in text format. We will be doing parallel integrity testing for a new system for several months and I'm trying to make it easier by programmatically generating a text file from an excel spreadsheet which is shared. My understanding is that you may run code from a shared spreadsheet, but some options are disallowed. I did not believe 'SaveAs' to be one of them, but...

I realize that I can grant exclusive access at the time in order to do this, but then the workbook gets saved as unshared, which is a problem.

Any ideas why this code won't work while the workbook is shared, or a way around it? Help!

RUN-TIME ERROR '1004'; Method 'SaveAs' of object '_Workbook' failed

I do not have the problem when the workbook is not shared, and since I can't step through the code (in shared mode) to determine exactly where it's failing, I am assuming it is here when I try to output the file:

OutputFileName = "253DLAB" & DateFormat & ".pay"
CompleteFile = Directory & "\" & OutputFileName
Worksheets("PAY_OutputFile").Activate
ActiveWorkbook.SaveAs FileName:=CompleteFile, _
FileFormat:=xlTextPrinter

Any ideas? Want to see more?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top