VB 6 runtime error

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

lamstaldy

Thread Starter
Joined
Dec 15, 2001
Messages
113
I'm writing a vb app that gets data over the comm port, manipulates the data, and then stores the data in Excel. My error occurs when I format the columns in Excel. I use the With statement to set the width of the first 10 columns. This works fine the first time I open Excel. However, if I close Excel and then open Excel (from within my app) I get "Run-time error '1004': Method 'Columns' of object '_Global' failed". If I get rid of the With statement and precede all my column format lines with the ExcelSheet object name then everything works ok.
 

lamstaldy

Thread Starter
Joined
Dec 15, 2001
Messages
113
I just re-read my original post and realized that it is nearly incomprehensible. I've attached a ZIP file (renamed as .txt) that includes two vb projects and two vb forms. One project works and the other causes an error if you open, then close, and then open Excel using the command buttons. The only difference between the two is the use of a With statement. I've changed my original project to eliminate the With statement, but I'm still interested in knowing why this happens.
 

Attachments

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top