Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
save as txt saves different tab, why???
hello
I have big workbook with many macros helping people to sort out some complicated document. anyway last step after document has been edited, one tab needs to be saved as txt file. I wrote a macro that does it (it is run from a button on tab called 'summary'). tab that needs to be saved as txt is called 'output'. tab 'output' contains very long lines over 255 characters long. problem is macro saves different tab sometimes and I have no idea why. macro is simple and goes like that: Dim fname '- define file name fname = "cardex" & Mid(Worksheets("output").Range("a2"), 23, 8) & ".txt" Dim cpath '-define path - range A7 contains path cpath = Worksheets("summary").Range("a7") Sheets("output").Select ActiveWorkbook.SaveAs Filename:=cpath & fname, FileFormat:=xlText, _ CreateBackup:=False any ideas greatly appreciated |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
save as txt saves different tab, why???
Your posted pseudo code looks ok to me. I'd check to see if you were actually
selecting the correct worksheet first. I'd do this instead. your dim's here your assignments here worksheets("output").copy 'to a new workbook activeworkbook.saveas .... activeworkbook.close savechanges:=false shark102 wrote: hello I have big workbook with many macros helping people to sort out some complicated document. anyway last step after document has been edited, one tab needs to be saved as txt file. I wrote a macro that does it (it is run from a button on tab called 'summary'). tab that needs to be saved as txt is called 'output'. tab 'output' contains very long lines over 255 characters long. problem is macro saves different tab sometimes and I have no idea why. macro is simple and goes like that: Dim fname '- define file name fname = "cardex" & Mid(Worksheets("output").Range("a2"), 23, 8) & ".txt" Dim cpath '-define path - range A7 contains path cpath = Worksheets("summary").Range("a7") Sheets("output").Select ActiveWorkbook.SaveAs Filename:=cpath & fname, FileFormat:=xlText, _ CreateBackup:=False any ideas greatly appreciated -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
save as txt saves different tab, why???
thanks, it does the trick. I still wonder why my 'pseudocode' was saving
wrong tab sometime. is below line ambiguous maybe? sheets("output").select ??? just out of curiosity, some codes are referred to as 'pseudocodes', what is the difference? thanks again "Dave Peterson" wrote: Your posted pseudo code looks ok to me. I'd check to see if you were actually selecting the correct worksheet first. I'd do this instead. your dim's here your assignments here worksheets("output").copy 'to a new workbook activeworkbook.saveas .... activeworkbook.close savechanges:=false shark102 wrote: hello I have big workbook with many macros helping people to sort out some complicated document. anyway last step after document has been edited, one tab needs to be saved as txt file. I wrote a macro that does it (it is run from a button on tab called 'summary'). tab that needs to be saved as txt is called 'output'. tab 'output' contains very long lines over 255 characters long. problem is macro saves different tab sometimes and I have no idea why. macro is simple and goes like that: Dim fname '- define file name fname = "cardex" & Mid(Worksheets("output").Range("a2"), 23, 8) & ".txt" Dim cpath '-define path - range A7 contains path cpath = Worksheets("summary").Range("a7") Sheets("output").Select ActiveWorkbook.SaveAs Filename:=cpath & fname, FileFormat:=xlText, _ CreateBackup:=False any ideas greatly appreciated -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
save as txt saves different tab, why???
I didn't see anything wrong that popped out when I looked at your code. I don't
have a guess why the code that you posted would fail--maybe there was something in the code that you didn't post???? Psuedo code is false code--it's not ready to just copy and paste into a module and run as-is. It can include as much detail (or as few details) as the author wants/needs. Open a workbook file work on the pricing sheet Update the values for customer xxx by 5% to a maximum of 280% of the cost. Create a report sheet for those parts Save the workbook file as a new name Close the workbook is a pretty high level of psuedo code. It may be enough for one person to continue to develop the project. Other people may want to add more details. shark102 wrote: thanks, it does the trick. I still wonder why my 'pseudocode' was saving wrong tab sometime. is below line ambiguous maybe? sheets("output").select ??? just out of curiosity, some codes are referred to as 'pseudocodes', what is the difference? thanks again "Dave Peterson" wrote: Your posted pseudo code looks ok to me. I'd check to see if you were actually selecting the correct worksheet first. I'd do this instead. your dim's here your assignments here worksheets("output").copy 'to a new workbook activeworkbook.saveas .... activeworkbook.close savechanges:=false shark102 wrote: hello I have big workbook with many macros helping people to sort out some complicated document. anyway last step after document has been edited, one tab needs to be saved as txt file. I wrote a macro that does it (it is run from a button on tab called 'summary'). tab that needs to be saved as txt is called 'output'. tab 'output' contains very long lines over 255 characters long. problem is macro saves different tab sometimes and I have no idea why. macro is simple and goes like that: Dim fname '- define file name fname = "cardex" & Mid(Worksheets("output").Range("a2"), 23, 8) & ".txt" Dim cpath '-define path - range A7 contains path cpath = Worksheets("summary").Range("a7") Sheets("output").Select ActiveWorkbook.SaveAs Filename:=cpath & fname, FileFormat:=xlText, _ CreateBackup:=False any ideas greatly appreciated -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Saves Once only | Excel Discussion (Misc queries) | |||
What happens when Excel 07 saves? | Excel Discussion (Misc queries) | |||
counting saves | Excel Discussion (Misc queries) | |||
when I save a file from Excel 2003 to cd it saves as read only | Excel Worksheet Functions | |||
Save As CSV saves empty rows | Excel Discussion (Misc queries) |