PC Review


Reply
Thread Tools Rate Thread

HOW TO CHANGE DRIVE ADDRESS IN MACRO

 
 
K
Guest
Posts: n/a
 
      3rd Jun 2008
Hi, the macro below works perfectly fine for me but I have little
problem that file address in macro got drive F: as I am working on F:
drive on my pc but as my file will be used by other colleagues and
they are on different drives like Y: , Z: etc because we working on
network. So is it possible that where it say F:\ in macro i can put
Range("A1").value and in cell A1 i can put like drop down which have
A: to Z: drive listing so if any body is on different drive then they
can just change their dive character in cell A1. I tried doing like
this but its not working. can any body have any suggestion that what
should i do.

MACRO
===============>
Sub SAV()
Range("A13:L58").Select
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
F:\TRANSFERS & VIREMENTS RECORD\ & Range("A13").Value & " (" &
Range("K16").Value & ")" & " - " & Range("K13").Value & ".htm", _
ActiveSheet.Name, "$A$13:$L$58", xlHtmlStatic, , "")
..Publish (True)
..AutoRepublish = False
End With
Range("B27").Select
End Sub
<================
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      3rd Jun 2008
Something like this maybe?

With ActiveWorkbook.PublishObjects.Add(xlSourceRange, Range("A1").Value & _
"\TRANSFERS" & "VIREMENTS RECORD\" & Range("A13").Value & " (" & _
Range("K16").Value & ")" & " - " & Range("K13").Value & ".htm", _
ActiveSheet.Name, "$A$13:$L$58", xlHtmlStatic, , "")

Note that, as written, you code line is not correct (you are missing quote
marks around some of your String constants), so I patched it the best I
could, but I **think** you are missing a backslash (can't tell for sure)
between the "\TRANSFERS" and "VIREMENTS RECORD\" parts. In any case (whether
you are missing one or not), you can do away with concatenating them and
simply place them in the same String constant. For future postings you may
do, please copy/paste your actual code lines instead of re-typing them... it
is hard to tell whether the mistyping's are the source of your problem or
not.

Rick


"K" <(E-Mail Removed)> wrote in message
news:f90e0f24-acc0-42af-8d8e-(E-Mail Removed)...
> Hi, the macro below works perfectly fine for me but I have little
> problem that file address in macro got drive F: as I am working on F:
> drive on my pc but as my file will be used by other colleagues and
> they are on different drives like Y: , Z: etc because we working on
> network. So is it possible that where it say F:\ in macro i can put
> Range("A1").value and in cell A1 i can put like drop down which have
> A: to Z: drive listing so if any body is on different drive then they
> can just change their dive character in cell A1. I tried doing like
> this but its not working. can any body have any suggestion that what
> should i do.
>
> MACRO
> ===============>
> Sub SAV()
> Range("A13:L58").Select
> With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
> F:\TRANSFERS & VIREMENTS RECORD\ & Range("A13").Value & " (" &
> Range("K16").Value & ")" & " - " & Range("K13").Value & ".htm", _
> ActiveSheet.Name, "$A$13:$L$58", xlHtmlStatic, , "")
> .Publish (True)
> .AutoRepublish = False
> End With
> Range("B27").Select
> End Sub
> <================


 
Reply With Quote
 
Ray
Guest
Posts: n/a
 
      3rd Jun 2008
The best way is not to use the letter at all but to hard-code the full
network path. So, instead of
F:\TRANSFERS & VIREMENTS RECORD\ ...
make it
\\server\folder\folder\folder\TRANSFERS & VIREMENTS RECORD\ ...

The full path should be available in the My Network Places section of
Windows Explorer ...

//ray
 
Reply With Quote
 
K
Guest
Posts: n/a
 
      3rd Jun 2008
On Jun 3, 4:10*pm, Ray <rschin...@gmail.com> wrote:
> The best way is not to use the letter at all but to hard-code the full
> network path. *So, instead of
> F:\TRANSFERS & VIREMENTS RECORD\ ...
> make it
> \\server\folder\folder\folder\TRANSFERS & VIREMENTS RECORD\ ...
>
> The full path should be available in the My Network Places section of
> Windows Explorer ...
>
> //ray


Thanks lot Rick and Ray. Your codes were fantastic.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change web address in macro Woodi2 Microsoft Excel Programming 6 1st Dec 2008 06:59 PM
Change from and repy-to address with a macro Jonas Svensson Microsoft Outlook VBA Programming 1 24th Aug 2006 07:30 AM
Macro with Drive-change? =?Utf-8?B?RGFuaWVsIFIuIFlvdW5n?= Microsoft Excel Programming 3 11th Oct 2005 03:11 PM
Change IP address with macro broogle Microsoft Excel Programming 0 8th Jul 2005 01:51 AM
Automatic change the first Address List in Outlook 2000 Address Book Jasper Microsoft Outlook 0 7th Aug 2003 09:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:20 PM.