user2999509
user2999509

Reputation: 107

Excel VBA suddenly not able to open workbooks?

My problem is very strange.

I was programming a macro to open workbooks and extract data which was going fine when it hung one time. I had to end process in task manager and restarted excel.

Now even basic file opening code doesn't work.

My basic code is like this

File path is C:/ and fileName is Book1
Set wbOpen (filePath & fileName)
        wbopen.activeSheet.Range ("A1") = "Test" 
        .close SaveChanges:= True
        Msgbox "ok" 

.... end sub

The code used to work and i would see book1 being opened on the taskbar and the cell A1 will be changed. Now i still get the Ok message but the cells arent changed and i dont see book1 being opened. Any idea? Pls and thank you

Tried it on another PC and it doesnt work, could be excel settings

Already reset settings using the /regserver method and deleted the .vbe files under AppData too.

Upvotes: 0

Views: 87

Answers (1)

user2999509
user2999509

Reputation: 107

Sorry, was a very stupid mistake, must have accidentally set file path to "C:/Excel" instead of "C:/Excel/"

Tracked it down by using the msg box to print out the file im trying to access

Upvotes: 1

Related Questions