Need help with opening workbook from web page, please

rogersj

Board Regular
Joined
Aug 13, 2002
Messages
187
myName = ThisWorkbook.Name

If Range("O7") = "Tech - Body" Then

Workbooks.Open FileName:= _
"Q:Body - Chassis.xls"
Sheets("Body").Select
Rows("2:2").Select
Selection.insert Shift:=xlDown
Windows(myName).Activate
Range("B1").Select
Selection.Copy
Windows("Body - Chassis.xls").Activate
Range("A2").Select
ActiveSheet.Paste
Windows(myName).Activate
ActiveWindow.SmallScroll Down:=11
Range("B12").Select
Application.CutCopyMode = False



If the document is opened from a web site, it saves the document in a temp dir, as a temp name. I can't run this macro without getting a "Subscript out of range" I select debug and it points to "Windows(myName).Activate"

Im not sure if this matters but it does open this file as a Read Only. If I save this file as any name, to my HDD, it will run just fine. But I would like to be able to launch this file from the website, and run the macro.

Any tips? Thank you
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
can you not input an activeworkbook.SaveAs at the beginning of the macro and thus avoid the temp directory problem, or an if so if the file name = designated file name then cool, if not ActiveWorkbook.SaveAs etc?
 

rogersj

Board Regular
Joined
Aug 13, 2002
Messages
187
Hmmm.. ::ponder:: I've never thoguht of that... Saving the macro to the users temp dir. That should rid the 'Read Only'.

How could I: ActiveWorkbook.SaveAs C:WindowsTemptemp.xls overwrite = yes?

Overwrite so the next time they run the macro it dont ask to overwrite.
 

Forum statistics

Threads
1,143,915
Messages
5,721,512
Members
422,369
Latest member
redinator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top