Hi, I have several old macros that worked for years when Excel was installed on my machine.
They are in MS Project 2010 and Open and Excel and move data from Project to Excel sheets.
The company moved me to Office Online, and the macros stopped working because the Reference files no longer exist.
The macro worked great, but code is very messy from years of patches...
So I am looking for help on the types of issues listed below...
It seems changing from Early Binding to Late Binding will fix the problem.
I have changed statements like as follows:
'changed to:
This seems to work, the macro opens Excel...
I was using statements like the following to set variable names:
These statements don't work now...
Below are examples of how I use these variables:
Using xlRange as an example, I have code like:
Using xlSheet as an example, I have code like:
Using xlCols as an example, I have code like:
Can you give me some ideas on what I need to fix?
Thanks for any help provided.
They are in MS Project 2010 and Open and Excel and move data from Project to Excel sheets.
The company moved me to Office Online, and the macros stopped working because the Reference files no longer exist.
The macro worked great, but code is very messy from years of patches...
So I am looking for help on the types of issues listed below...
It seems changing from Early Binding to Late Binding will fix the problem.
I have changed statements like as follows:
VBA Code:
Dim xlApp As Excel.Application 'Early Binding Method
VBA Code:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
This seems to work, the macro opens Excel...
I was using statements like the following to set variable names:
VBA Code:
Dim xlRange As Excel.Range
Dim xlSheet As Excel.Worksheet
Dim xlCols As Excel.Range
Below are examples of how I use these variables:
Using xlRange as an example, I have code like:
VBA Code:
Set xlRange = xlSheet.Range("a1:" & "U" & numrows)
With xlRange
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = vbBlack
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = vbBlack
End With
End With
Using xlSheet as an example, I have code like:
VBA Code:
With pxlsheet
.Rows(1).Font.Size = 11
.Rows(1).Font.Bold = True
.Cells(1, 1).Value = "ID"
.Cells(1, 2).Value = "UID"
For i = 1 To 21
.Cells(1, i).Interior.Color = RGB(135, 206, 250)
.Cells(1, i).HorizontalAlignment = xlCenter
Next i
End With
Using xlCols as an example, I have code like:
VBA Code:
Set xlCols = .Columns(1) 'ID
With xlCols
.ColumnWidth = 5
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.Locked = True
End With
Can you give me some ideas on what I need to fix?
Thanks for any help provided.