(Solved) – How to get the first column of an excel file using VBA present in VISIO


I have a Visio file in which I wrote VBA code. Earlier I was giving input manually. Now I want to give the input using an excel file. The input is present in the first column of the excel file. The following code is not giving the desired result.

Sub OpenSaveExcel()

Dim objXLApp As Object
Dim objXLBook As Object
Dim strArray As Variant
Dim TotalRows As Long

Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("File location")
Dim x As Variant

x = objXLBook.Sheet1.Range("A1:A10")
Debug.Print x(1, 1)

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *