Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Coder,

 

I'm working on vb.net app that I want to do the following and hoping members can guide me to right direction. I want my program to be able to go to each excel files and expand the cell columns and if I click on 11 x 17, then my app will change excel print size to 11 x 17. Any idea? :confused: Thank you in advance

 

all comments are welcome. :p

Posted

Well, changing the Worksheet's column width would look something like this:

Dim xlWS As Worksheet = CType(xlApp.ActiveSheet, Excel.Worksheet)
xlWS.Columns("A:C").ColumnWidth = 20

I've never changed the print settings to 11x17, but I guess it would look something like this:

xlWS.PaperSize = Excel.XlPaperSize.xlPaper11x17

Hope this helps...

 

-- Mike

Posting Guidelines

 

Avatar by Lebb

Posted
Sorry, it looks like I forgot a cast in the above. Try this when you get home:
Dim xlWS As Excel.Worksheet = CType(xlApp.ActiveSheet, Excel.Worksheet)
CType(xlWS.Columns("A:C"), Excel.Range).ColumnWidth = 20

-- Mike

Posting Guidelines

 

Avatar by Lebb

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...