TJLD22
TJLD22

Reputation: 145

macro: how to browse excel file and read data

I am writing a macro script in 3 steps:

read an excel file by browse - transfer to xml format - export xml file to certain path by browse. I know how to export by browse alrady.

Set objShell = CreateObject("Shell.application")
Set objFolder = objShell.BrowseForFolder(0, "choose the path you want to export the xml file", 0, 0)

but this one is browseforfolder.

How to browse for file? if I want to import excel data by browse?

thx

Upvotes: 0

Views: 1030

Answers (1)

Kovags
Kovags

Reputation: 540

To open the "open file" dialog, I use the following:

FileOpenName = Application.GetOpenFilename(fileFilter:="All files (*.*), *.*")

Then you're going to need following to open the files the

Open FileOpenName For (Binary|Write) as #1
   'Do writing operations here
Close #1

Upvotes: 2

Related Questions