12-31-2015 01:07 PM
HeyBen,
Im havving trouble understand what you mean there. So when i open my csv file, i am copying the content using range which then go back out through the spreadsheet into the save workbook. Not exactly sure how i can open a template after that. I apologize, you have me confused. I'll spend some time on this and get back to you. Happy New Years guys and thanks for all your help!
12-31-2015 02:14 PM
XxLinkxX a écrit :
HeyBen,
Im havving trouble understand what you mean there. So when i open my csv file, i am copying the content using range which then go back out through the spreadsheet into the save workbook. Not exactly sure how i can open a template after that. I apologize, you have me confused. I'll spend some time on this and get back to you. Happy New Years guys and thanks for all your help!
When you open the csv file in Excel the application takes care of the data type conversion (when data type is recognizable, Excel cell format will probably be General in your case), it opens as a temporary workbook (it is not saved yet and doesn't need to be).
You can copy the contained data to the clipboard using the Range Copy method. You now open your template (this should be a xltx file). When an xltx file is called Excel opens it as an xlsx file that contains the formatting of the xltx file (the new file will have the name "TemplateName1"), Once opened, select the range where you want the data copied and use the worksheet paste method to paste the values in it. Then save this new workbook as an xlsx file with the name you want.
Ben64
01-04-2016 07:28 AM
Hey Ben,
Thanks for VI, It helps alot. I wouldnt have known to open the template as well. When i was trying to open the csv file i was trying to copy and paste with the template without opening it. I was using add template. No wonder i was having an issue. Also, one minor question i had was when using the save workbook, what does xlExclusive mean for accessmode with a constant 2 for the conflict resolution? Is that having to do with the file extension? Thanks again!
01-04-2016 08:12 AM
The ConflictResolution set to 2 is to always accept local user modification. With setting DisplayAlerts to False you will not receive any notification (if you use the same name as an existing file it will overwrite it without warning popup). xlExclusive access mode is probably not necessary and could be removed (thus using the default access mode), exclusive access is used to avoid other user modifiying the file. It has nothing to do with the file extension.
Ben64
01-04-2016 09:16 AM
Thanks Ben! Learning alot from you and your style. Would you reccomend me to some good labview tutorials/classes.hopefullly free ones. I find the one on labview a tad pricy.
01-04-2016 09:26 AM
Have a look at the 3rd post of this thread, there is links to free online tutorials. Of course the forum is also a good source learning source.
Ben64
01-04-2016 10:45 AM
Thanks Ben! Link 2 was not working but i believe i found it in search (3 Hour course). Hopefully they update it.