Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 3
Default Open Filename + SendKeys

I am writing a macro for Excel 2002 in VB. I am opening a .csv file from a
protected part of my web site. I have a dialog box requesting my user name
and password. Excel remembered the values from last time, so all I have to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the document to
actually open? (The SendKeys "{ENTER}" is to get past the dialog box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew




  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 1
Default Open Filename + SendKeys

I didn't think you could go onto the next step if the file wasn't open?

--
Regards

Steven Burn
Ur I.T. Mate Group CEO
www.it-mate.co.uk
Matthew wrote in message
...
I am writing a macro for Excel 2002 in VB. I am opening a .csv file from

a
protected part of my web site. I have a dialog box requesting my user

name
and password. Excel remembered the values from last time, so all I have

to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the document

to
actually open? (The SendKeys "{ENTER}" is to get past the dialog box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew






  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Open Filename + SendKeys

Hi Matthew,
This works for me.

Workbooks.Open Filename:="http://www.osbornewood.com/_private/test.csv",
password:="yourpasswordhere"

That is the website password, not the file password.

--

John

johnf202 at hotmail dot com


"Matthew" wrote in message
...
I am writing a macro for Excel 2002 in VB. I am opening a .csv file from

a
protected part of my web site. I have a dialog box requesting my user

name
and password. Excel remembered the values from last time, so all I have

to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the document

to
actually open? (The SendKeys "{ENTER}" is to get past the dialog box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew






  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 3
Default Open Filename + SendKeys

John,

That looks good. However, when I tried it I got the error message:

Compile error:
Syntax error

I looked at it in the debugger, and tried again. The next time it said:

Compile error:
Expected: named parameter

It highlighted the first line. I put the second line (password) on the
first line; it liked that (no error messages) but it still displayed the
dialog box, waiting for me to hit OK.

Matthew

"jaf" wrote in message
...
Hi Matthew,
This works for me.

Workbooks.Open Filename:="http://www.osbornewood.com/_private/test.csv",
password:="yourpasswordhere"

That is the website password, not the file password.

--

John

johnf202 at hotmail dot com


"Matthew" wrote in message
...
I am writing a macro for Excel 2002 in VB. I am opening a .csv file

from
a
protected part of my web site. I have a dialog box requesting my user

name
and password. Excel remembered the values from last time, so all I have

to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open

Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the

document
to
actually open? (The SendKeys "{ENTER}" is to get past the dialog box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew








  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Open Filename + SendKeys

Hi Matthew,
It was one line, it wrapped in the newsreader. There should be a comma
before password.


--

John

johnf202 at hotmail dot com


"Matthew" wrote in message
...
John,

That looks good. However, when I tried it I got the error message:

Compile error:
Syntax error

I looked at it in the debugger, and tried again. The next time it said:

Compile error:
Expected: named parameter

It highlighted the first line. I put the second line (password) on the
first line; it liked that (no error messages) but it still displayed the
dialog box, waiting for me to hit OK.

Matthew

"jaf" wrote in message
...
Hi Matthew,
This works for me.

Workbooks.Open Filename:="http://www.osbornewood.com/_private/test.csv",
password:="yourpasswordhere"

That is the website password, not the file password.

--

John

johnf202 at hotmail dot com


"Matthew" wrote in message
...
I am writing a macro for Excel 2002 in VB. I am opening a .csv file

from
a
protected part of my web site. I have a dialog box requesting my user

name
and password. Excel remembered the values from last time, so all I

have
to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open

Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the

document
to
actually open? (The SendKeys "{ENTER}" is to get past the dialog

box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew












  #6   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 3
Default Open Filename + SendKeys

If anybody is interested, the answer was to put "SendKeys" before
"Workbooks.Open Filename".

Matthew

"Matthew" wrote in message
...
I am writing a macro for Excel 2002 in VB. I am opening a .csv file from

a
protected part of my web site. I have a dialog box requesting my user

name
and password. Excel remembered the values from last time, so all I have

to
do is click "OK" or hit enter on the keyboard.

I tried the following script, but it seems to want to finish Open Filename
before going on to SendKeys.

Workbooks.Open Filename:= _
"http://www.osbornewood.com/_private/test.csv"
SendKeys "{ENTER}"

How can I make it go on to the next step without waiting for the document

to
actually open? (The SendKeys "{ENTER}" is to get past the dialog box.)

Is this the right general idea, or am I totally on the wrong track?

Matthew






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetOpen filename to open files(Workbooks) Frank Situmorang[_3_] Excel Discussion (Misc queries) 11 May 5th 09 01:02 PM
Workbooks.Open Filename Konczér Tamás Excel Worksheet Functions 2 July 4th 07 04:21 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
Double-CLK open appends a number to filename JeffSanders Excel Discussion (Misc queries) 1 March 20th 06 08:01 PM
why does excel 2002 add a '1' to the filename everytime I open a f canoeweasel Excel Discussion (Misc queries) 4 September 29th 05 08:19 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"