LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch Excel columns and rows in write to spreadsheet and more

You need to tell Read File how many bytes to read.  I would typically wire the refnum of Open File into a Refnum to Path function and wire this path to File/Directory Info.  Wire the Size output to the count input of Read File.

0 Kudos
Message 31 of 36
(783 Views)

Wouldn't it simply be easier to just copy the file and work with the copy as your new spreadsheet?

0 Kudos
Message 32 of 36
(780 Views)

 


@Darin.K wrote:

You need to tell Read File how many bytes to read.  I would typically wire the refnum of Open File into a Refnum to Path function and wire this path to File/Directory Info.  Wire the Size output to the count input of Read File.


 Thanks, that worked (you're amazing, btw). I got a blank template file out with the macro in it. 


@smercurio_fc wrote:

Wouldn't it simply be easier to just copy the file and work with the copy as your new spreadsheet?


I'm trying to be able to store the .xls template in a string inside the VI to create it whenever its needed, so the end user doesn't have to deal with copying a specific blank file in each time. 

 

0 Kudos
Message 33 of 36
(776 Views)

 


@bobholmgren wrote:

 


@Darin.K wrote:

You need to tell Read File how many bytes to read.  I would typically wire the refnum of Open File into a Refnum to Path function and wire this path to File/Directory Info.  Wire the Size output to the count input of Read File.


 Thanks, that worked (you're amazing, btw). I got a blank template file out with the macro in it. 


@smercurio_fc wrote:

Wouldn't it simply be easier to just copy the file and work with the copy as your new spreadsheet?


I'm trying to be able to store the .xls template in a string inside the VI to create it whenever its needed, so the end user doesn't have to deal with copying a specific blank file in each time. 

 


I wasn't implying for the user to copy the file. I was implying for you to copy the file. You'd have the template file along with your app and you copy the file and use it as the new file.

 

0 Kudos
Message 34 of 36
(763 Views)

 


@smercurio_fc wrote:

 


@bobholmgren wrote:

 


@Darin.K wrote:

You need to tell Read File how many bytes to read.  I would typically wire the refnum of Open File into a Refnum to Path function and wire this path to File/Directory Info.  Wire the Size output to the count input of Read File.


 Thanks, that worked (you're amazing, btw). I got a blank template file out with the macro in it. 


@smercurio_fc wrote:

Wouldn't it simply be easier to just copy the file and work with the copy as your new spreadsheet?


I'm trying to be able to store the .xls template in a string inside the VI to create it whenever its needed, so the end user doesn't have to deal with copying a specific blank file in each time. 

 


I wasn't implying for the user to copy the file. I was implying for you to copy the file. You'd have the template file along with your app and you copy the file and use it as the new file.

 


 

Ah, I get what you're saying. Yeah, that would have worked (and taken the same amount of disk space too), but I've already written all this new code. Hmm, I might switch to what you recommended though, cause then it'd be easier to change the template code (just move the new file in with the same name) as opposed to having to paste in text of the binary if I modify the template

0 Kudos
Message 35 of 36
(760 Views)

Either method will work in your case.  I rarely use Excel, but when I do I write my own xlsx or xlsm files so I do not have to have Excel installed on all of my machines.  With this method, once you have the skeleton, it is easy to add macros, charts, sheets, etc. without using ActiveX or Excel itself.  I only need the starting point and all changes can be made programmatically.  Keeping a string constant is quick and easy for me.  If you are using ActiveX I can see that you probably want to modify your macro several times. 

 

When you upgrade to LV9 I can help free you from ActiveX, until then, keep plugging away.

0 Kudos
Message 36 of 36
(754 Views)