0

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

3
  • 1
    You have not accepeted an answer to any of your prior questions. You are more likely to get assistance if you are viewed as engaging fully with the people helping you. Commented Sep 11, 2012 at 7:56
  • excuse me, I log SO about 3 weeks. every time i just click "yes" for "is it useful for you?" but how to show I accept the answer? Commented Sep 11, 2012 at 8:07
  • 2
    Just click the gray check-mark next to the answer that solved your problem. stackoverflow.com/faq#howtoask Commented Sep 11, 2012 at 9:04

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

thx. could u explain further if the script want to use several worksheets' data from that FileOpenName. I do not understand very much about that Open... Close #1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.