Code Problem

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,970
Office Version
  1. 2010
Platform
  1. Windows
I have a problem with the following code

I changed (On both Occurances)

ChDir "'\\hqnas01p\cac$\Management\Customer Relations\Complaint Log"

from

ChDir "'Z:\Management\Customer Relations\Complaint Log"

So I could dial straight into the server, over using a filepath & this wont work now, I could change it back - but it has all sorts of complications with certain people not having certain drives mapped to their profile

Any idea's Guys?

TIA

Code:
Sub Open_Complaint_Log()

'Script which opens the complaint log from its network location
'Link changed to CAC S: MA

Application.ScreenUpdating = False
ChDir "'\\hqnas01p\cac$\Management\Customer Relations\Complaint Log"
    Workbooks.Open Filename:= _
        "'\\hqnas01p\cac$\Management\Customer Relations\Complaint Log\Complaint Log 2006.xls"
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Mark

I think ChDir only works with mapped drive letters (not 100% sure about this). Why do you need to use ChDir anyway?

Richard
 
Upvote 0
Mark

I think ChDir only works with mapped drive letters (not 100% sure about this). Why do you need to use ChDir anyway?

Richard

I thought this was the only way to open a File Richard?

Is there another?

(PS Sorry for the delay, meetings an all that!)
 
Upvote 0
Mark

You're already giving the Workbooks statement the full path & name, so amending the ChDir doesn't actually do anything in this instance.

You should be able to safely comment the ChDir statement out.

Richard
 
Upvote 0
Mark

You're already giving the Workbooks statement the full path & name, so amending the ChDir doesn't actually do anything in this instance.

You should be able to safely comment the ChDir statement out.

Richard

It doesn't like it without the ChDir?
 
Upvote 0
Mark

In your code, you appear to have a rogue single quote in the Workbooks.Open line, can you take it out and see if it makes a difference.

Richard
 
Upvote 0
Mark

In your code, you appear to have a rogue single quote in the Workbooks.Open line, can you take it out and see if it makes a difference.

Richard

Rogue Signal? I dont follow you Richard?
 
Upvote 0
The following has a single quote at the beginning of the file&Pathname:

Code:
Workbooks.Open Filename:= _ 
        "'\\hqnas01p\cac$\Management\Customer Relations\Complaint Log\Complaint Log 2006.xls"

Richard
 
Upvote 0
The following has a single quote at the beginning of the file&Pathname:

Code:
Workbooks.Open Filename:= _ 
        "'\\hqnas01p\cac$\Management\Customer Relations\Complaint Log\Complaint Log 2006.xls"

Richard

I tried without Richard & it still wont have it?

Also - I have a problem here too

Excel.jpg
 
Upvote 0
Code for above picture

Code:
Private Sub workbook_open()

Application.ScreenUpdating = False
Application.StatusBar = "Development & Design by Mark Andrews"
Sheets("Criteria Selection & Pivots").Select
MsgBox "Welcome " & Application.UserName
MsgBox ("To recalculate this document, please change the dates in cells A2 & B2, then click 'Refresh Entire Document'")
Range("A2").Select
With Sheets("Productivity")
    .Cells(1, 3) = Format(Date, "mmmm")
    '.Cells(1, 4) = "=DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0))"
    .Cells(1, 4) = Evaluate("=DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0))")
    End With
Application.ScreenUpdating = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,550
Messages
6,114,265
Members
448,558
Latest member
aivin

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
Back
Top