mrlemmer11
New Member
- Joined
- Jun 8, 2015
- Messages
- 32
Hi all,
So, im working in WORD VBA and I have the following code to call my excel document for information. As I am doing multiple edits/testing to my WORD VBA UserForms, I am constantly starting and stopping my UF often time with code errors. After a couple hours I wanted to edit the source Excel file, but it said it was locked by another user (me) and I had to wait. I looked in task manager and saw EXCEL listed 38 times..... so I am apparently not closing the call to it correctly. Can anyone help? Thanks!
So, im working in WORD VBA and I have the following code to call my excel document for information. As I am doing multiple edits/testing to my WORD VBA UserForms, I am constantly starting and stopping my UF often time with code errors. After a couple hours I wanted to edit the source Excel file, but it said it was locked by another user (me) and I had to wait. I looked in task manager and saw EXCEL listed 38 times..... so I am apparently not closing the call to it correctly. Can anyone help? Thanks!
Code:
Private Sub Userform_Initialize()
Dim sourcedoc
Dim oExcel As Excel.ApplicationDim oWB As Workbook
Set oExcel = New Excel.Application
D
Application.ScreenUpdating = False
Set sourcedoc = oExcel.Workbooks.Open(FileName:="C:\users\michael\Desktop\SongIndex\BASlist.xlsx")
arBand = Range("L2:L9")
arAlbum = Range("I2:J245")
arSong = Range("E2:G298")
sourcedoc.Close SaveChanges:=wdDoNotSaveChanges
End Sub